2020-02-11 04:04:59 -05:00
|
|
|
// Specifier should be resolved relative to current file
|
2020-06-09 08:33:52 -04:00
|
|
|
const jsWorker = new Worker(
|
|
|
|
new URL("sibling_worker.js", import.meta.url).href,
|
|
|
|
{ type: "module", name: "sibling" }
|
|
|
|
);
|
2020-02-11 04:04:59 -05:00
|
|
|
|
2020-03-28 13:03:49 -04:00
|
|
|
jsWorker.onerror = (_e) => {
|
2020-02-11 04:04:59 -05:00
|
|
|
postMessage({ type: "error" });
|
|
|
|
};
|
|
|
|
|
2020-03-28 13:03:49 -04:00
|
|
|
jsWorker.onmessage = (e) => {
|
2020-02-11 04:04:59 -05:00
|
|
|
postMessage({ type: "msg", text: e });
|
|
|
|
close();
|
|
|
|
};
|
|
|
|
|
2020-03-28 13:03:49 -04:00
|
|
|
onmessage = function (e) {
|
2020-02-11 04:04:59 -05:00
|
|
|
jsWorker.postMessage(e.data);
|
|
|
|
};
|