fix(sw): skipWaiting + clients.claim -> neue Version aktiviert sofort (kein Stuck-auf-altem-Cache mehr); v6->v7
This commit is contained in:
parent
0001735207
commit
fc8d6dd065
1 changed files with 4 additions and 2 deletions
6
sw.js
6
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
|
||||
);
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue