We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent f0a3f43 commit 511972cCopy full SHA for 511972c
sw.js
@@ -99,7 +99,12 @@ self.addEventListener('install', e => {
99
* waitUntil(): activating ====> activated
100
*/
101
self.addEventListener('activate', event => {
102
- // TODO: consider some cleanning up.
+ // delete old deprecated caches.
103
+ caches.keys().then(cacheNames => Promise.all(
104
+ cacheNames
105
+ .filter(cacheName => ['precache-v1', 'runtime'].includes(cacheName))
106
+ .map(cacheName => caches.delete(cacheName))
107
+ ))
108
console.log('service worker activated.')
109
event.waitUntil(self.clients.claim());
110
});
0 commit comments