mirror of
https://github.com/denoland/deno.git
synced 2025-02-09 07:41:33 -05:00
![Bartek Iwańczuk](/assets/img/avatar_default.png)
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 });
|
|
}
|