chore(pwa): bump cache to v2, include variants.js, evict old caches
This commit is contained in:
parent
016ce93979
commit
49b3b53878
1 changed files with 10 additions and 1 deletions
11
sw.js
11
sw.js
|
|
@ -1,10 +1,11 @@
|
|||
const CACHE_NAME = 'dienstplan-pro-v1';
|
||||
const CACHE_NAME = 'dienstplan-pro-v2';
|
||||
const ASSETS = [
|
||||
'./',
|
||||
'./index.html',
|
||||
'./styles.css',
|
||||
'./app.js',
|
||||
'./calculator.js',
|
||||
'./variants.js',
|
||||
'./holidays.js',
|
||||
'./storage.js'
|
||||
];
|
||||
|
|
@ -15,6 +16,14 @@ self.addEventListener('install', (e) => {
|
|||
);
|
||||
});
|
||||
|
||||
self.addEventListener('activate', (e) => {
|
||||
e.waitUntil(
|
||||
caches.keys().then(keys => Promise.all(
|
||||
keys.filter(k => k !== CACHE_NAME).map(k => caches.delete(k))
|
||||
))
|
||||
);
|
||||
});
|
||||
|
||||
self.addEventListener('fetch', (e) => {
|
||||
e.respondWith(
|
||||
caches.match(e.request).then((response) => response || fetch(e.request))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue