mirror of
https://github.com/denoland/deno.git
synced 2024-12-11 10:07:54 -05:00
090169cfbc
This commit adds support for spawning Web Workers in self-contained binaries created with "deno compile" subcommand. As long as module requested in "new Worker" constructor is part of the eszip (by means of statically importing it beforehand, or using "--include" flag), then the worker can be spawned.
11 lines
205 B
TypeScript
11 lines
205 B
TypeScript
import "./worker.ts";
|
|
|
|
console.log("Starting worker");
|
|
const worker = new Worker(
|
|
new URL("./worker.ts", import.meta.url),
|
|
{ type: "module" },
|
|
);
|
|
|
|
setTimeout(() => {
|
|
worker.postMessage(42);
|
|
}, 500);
|