diff --git a/app.js b/app.js index f0fbb32..4de2874 100644 --- a/app.js +++ b/app.js @@ -12,8 +12,9 @@ customElements.define('m-page-menu', PageMenu) class Setup { async run() { - navigator.serviceWorker - .addEventListener('controllerchange', () => { + const sw = navigator.serviceWorker + + sw.addEventListener('controllerchange', () => { if (this.registration.active) { window.location.reload(true) } diff --git a/sw.js b/sw.js index b8de43e..6c8bede 100644 --- a/sw.js +++ b/sw.js @@ -13,6 +13,7 @@ async function initCache() { } self.addEventListener("install", event => { + self.skipWaiting() event.waitUntil(initCache()) })