mirror of
https://github.com/denoland/deno.git
synced 2025-02-23 13:43:31 -05:00

Adds another callback to WebWorkerOptions that allows to execute some modules before actual worker code executes. This allows to set up Node global using std/node.
9 lines
185 B
JavaScript
9 lines
185 B
JavaScript
console.log("hello from worker");
|
|
|
|
self.onmessage = (e) => {
|
|
if (e.data != "hello") {
|
|
throw new Error("wrong message");
|
|
}
|
|
|
|
self.postMessage({ pid: process.pid });
|
|
}
|