Merge pull request #17 from Lekensteyn/fix-serviceworker-check
This commit is contained in:
hackademix 2018-08-30 17:26:13 +02:00
commit 87d3401c0b
1 changed files with 6 additions and 6 deletions

View File

@ -85,13 +85,13 @@ ns.on("capabilities", () => {
if (!ns.canScript) { if (!ns.canScript) {
if (!!navigator.serviceWorker.controller) { if ("serviceWorker" in navigator && navigator.serviceWorker.controller) {
addEventListener("beforescriptexecute", e => e.preventDefault()); addEventListener("beforescriptexecute", e => e.preventDefault());
(async () => { (async () => {
for (let r of await navigator.serviceWorker.getRegistrations()) { for (let r of await navigator.serviceWorker.getRegistrations()) {
await r.unregister(); await r.unregister();
} }
})(); })();
} }
if (document.readyState !== "loading") onScriptDisabled(); if (document.readyState !== "loading") onScriptDisabled();