2020-02-11 10:04:59 +01:00
|
|
|
// Specifier should be resolved relative to current file
|
2020-06-09 13:33:52 +01:00
|
|
|
const jsWorker = new Worker(
|
2022-07-20 16:56:53 +02:00
|
|
|
import.meta.resolve("./sibling_worker.js"),
|
2020-07-14 15:24:17 -04:00
|
|
|
{ type: "module", name: "sibling" },
|
2020-06-09 13:33:52 +01:00
|
|
|
);
|
2020-02-11 10:04:59 +01:00
|
|
|
|
2020-03-29 04:03:49 +11:00
|
|
|
jsWorker.onerror = (_e) => {
|
2020-02-11 10:04:59 +01:00
|
|
|
postMessage({ type: "error" });
|
|
|
|
};
|
|
|
|
|
2020-03-29 04:03:49 +11:00
|
|
|
jsWorker.onmessage = (e) => {
|
2021-10-14 10:44:33 +01:00
|
|
|
postMessage({ type: "msg", text: e.data });
|
2020-02-11 10:04:59 +01:00
|
|
|
close();
|
|
|
|
};
|
|
|
|
|
2020-03-29 04:03:49 +11:00
|
|
|
onmessage = function (e) {
|
2020-02-11 10:04:59 +01:00
|
|
|
jsWorker.postMessage(e.data);
|
|
|
|
};
|