1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-22 15:06:54 -05:00
denoland-deno/cli/tests/testdata/compat/worker/worker.mjs
Bartek Iwańczuk 2fa0096821
compat: support --compat in web workers (#13629)
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.
2022-02-11 13:41:56 +01:00

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 });
}