diff --git a/sw.js b/sw.js index 933d659..15fa624 100644 --- a/sw.js +++ b/sw.js @@ -1,4 +1,4 @@ -const CACHE_NAME = 'dienstplan-pro-v6'; +const CACHE_NAME = 'dienstplan-pro-v7'; const ASSETS = [ './', './index.html', @@ -13,6 +13,8 @@ const ASSETS = [ ]; self.addEventListener('install', (e) => { + // Neue Version sofort uebernehmen, nicht auf Schliessen aller Tabs warten. + self.skipWaiting(); e.waitUntil( caches.open(CACHE_NAME).then((cache) => cache.addAll(ASSETS)) ); @@ -22,7 +24,7 @@ self.addEventListener('activate', (e) => { e.waitUntil( caches.keys().then((keys) => Promise.all(keys.filter((k) => k !== CACHE_NAME).map((k) => caches.delete(k))) - ) + ).then(() => self.clients.claim()) // laufende Tabs sofort uebernehmen ); });