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,
|
2020-07-14 15:24:17 -04:00
|
|
|
{ type: "module", name: "sibling" },
|
2020-06-09 08:33:52 -04:00
|
|
|
);
|
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) => {
|
2021-10-14 05:44:33 -04:00
|
|
|
postMessage({ type: "msg", text: e.data });
|
2020-02-11 04:04:59 -05:00
|
|
|
close();
|
|
|
|
};
|
|
|
|
|
2020-03-28 13:03:49 -04:00
|
|
|
onmessage = function (e) {
|
2020-02-11 04:04:59 -05:00
|
|
|
jsWorker.postMessage(e.data);
|
|
|
|
};
|