mirror of
https://github.com/denoland/deno.git
synced 2024-11-15 16:43:44 -05:00
18 lines
397 B
JavaScript
18 lines
397 B
JavaScript
// Specifier should be resolved relative to current file
|
|
const jsWorker = new Worker(
|
|
new URL("sibling_worker.js", import.meta.url).href,
|
|
{ type: "module", name: "sibling" }
|
|
);
|
|
|
|
jsWorker.onerror = (_e) => {
|
|
postMessage({ type: "error" });
|
|
};
|
|
|
|
jsWorker.onmessage = (e) => {
|
|
postMessage({ type: "msg", text: e });
|
|
close();
|
|
};
|
|
|
|
onmessage = function (e) {
|
|
jsWorker.postMessage(e.data);
|
|
};
|