2020-02-11 04:04:59 -05:00
|
|
|
// Specifier should be resolved relative to current file
|
|
|
|
const jsWorker = new Worker("./sibling_worker.js", {
|
|
|
|
type: "module",
|
2020-03-28 13:03:49 -04:00
|
|
|
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);
|
|
|
|
};
|