Artifact 38d097b5dbe67b21c49b66f7501449ec55dc6e7280e8e5c050cc6508864b8b7a:
- File
leaf/cmd/wasm/worker.js
— part of check-in
[eda7960b81]
at
2026-04-23 19:23:42
on branch trunk
— rename module to github.com/danmestas/EdgeSync
Fix the case-sensitive module path to match the actual GitHub repo URL (danmestas/EdgeSync). Remove tracked leaf/leaf binary and ignore .claude/skills/ scratchpad dirs. (user: [email protected], size: 1091) [annotate] [blame] [check-ins using] [more...]
// Web Worker wrapper for EdgeSync WASM leaf agent. // Usage: new Worker("worker.js") // Messages: { type: "init", config: {...} }, { type: "start" }, { type: "sync" }, { type: "stop" } importScripts("wasm_exec.js"); let go; self.onmessage = async function(e) { const msg = e.data; switch (msg.type) { case "init": go = new Go(); const result = await WebAssembly.instantiateStreaming( fetch(msg.wasmUrl || "leaf-browser.wasm"), go.importObject ); go.run(result.instance); const initResult = edgesync.newAgent(msg.config || {}); self.postMessage({ type: "init", result: initResult }); break; case "start": self.postMessage({ type: "started", result: edgesync.start() }); break; case "sync": self.postMessage({ type: "synced", result: edgesync.syncNow() }); break; case "stop": self.postMessage({ type: "stopped", result: edgesync.stop() }); break; } };