MCPcopy Create free account
hub / github.com/AudiusProject/hedgehog / WebWorker

Function WebWorker

src/utils.ts:12–18  ·  view source on GitHub ↗
(worker: Worker)

Source from the content-addressed store, hash-verified

10}
11
12export function WebWorker(worker: Worker) {
13 if (typeof window !== "undefined" && window.Worker) {
14 const code = worker.toString();
15 const blob = new Blob(["(" + code + ")()"]);
16 return new window.Worker(URL.createObjectURL(blob));
17 } else throw new Error("Cannot call web worker on the server");
18}
19
20/**
21 * Fallback for localStorage that works in node and the browser

Callers 1

createKeyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected