forked from mystiq/hydrogen-web
WIP working
This commit is contained in:
parent
3aa1992a3f
commit
ddf7d01760
2 changed files with 3 additions and 3 deletions
|
@ -37,11 +37,11 @@
|
||||||
const promise = new Promise(r => resolve = r);
|
const promise = new Promise(r => resolve = r);
|
||||||
const onMessage = function(event) {
|
const onMessage = function(event) {
|
||||||
if (event.data.replyTo === body.id) {
|
if (event.data.replyTo === body.id) {
|
||||||
worker.removeEventListener("message", onMessage);
|
navigator.serviceWorker.removeEventListener("message", onMessage);
|
||||||
resolve(event.data.content);
|
resolve(event.data.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
worker.addEventListener("message", onMessage);
|
navigator.serviceWorker.addEventListener("message", onMessage);
|
||||||
worker.postMessage(body);
|
worker.postMessage(body);
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
|
@ -148,6 +148,6 @@ export async function main(container, paths, legacyExtras) {
|
||||||
const view = new RootView(vm);
|
const view = new RootView(vm);
|
||||||
container.appendChild(view.mount());
|
container.appendChild(view.mount());
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error(`${err.message}:\n${err.stack}sdfdf`);
|
console.error(`${err.message}:\n${err.stack}dfdfdfdf`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue