1
0
Fork 0
mirror of https://github.com/codedread/bitjs synced 2025-10-04 18:19:15 +02:00

Fix JS error in WebWorker wrapper

This commit is contained in:
Jeff Schiller 2024-01-25 19:44:10 -08:00
parent 6d7d4abac7
commit 5bf583c617

View file

@ -15,9 +15,11 @@
/** @type {MessagePort} */ /** @type {MessagePort} */
let implPort; let implPort;
let module;
onmessage = async (evt) => { onmessage = async (evt) => {
if (evt.data.implSrc) { if (evt.data.implSrc) {
const module = await import(evt.data.implSrc); module = await import(evt.data.implSrc);
module.connect(evt.ports[0]); module.connect(evt.ports[0]);
} else if (evt.data.disconnect) { } else if (evt.data.disconnect) {
module.disconnect(); module.disconnect();