mirror of
https://github.com/denoland/deno.git
synced 2024-11-01 09:24:20 -04:00
20 lines
400 B
JavaScript
20 lines
400 B
JavaScript
|
// Specifier should be resolved relative to current file
|
||
|
const jsWorker = new Worker("./sibling_worker.js", {
|
||
|
type: "module",
|
||
|
name: "sibling"
|
||
|
});
|
||
|
|
||
|
jsWorker.onerror = _e => {
|
||
|
postMessage({ type: "error" });
|
||
|
};
|
||
|
|
||
|
jsWorker.onmessage = e => {
|
||
|
console.log("js worker on message");
|
||
|
postMessage({ type: "msg", text: e });
|
||
|
close();
|
||
|
};
|
||
|
|
||
|
onmessage = function(e) {
|
||
|
jsWorker.postMessage(e.data);
|
||
|
};
|