This commit is contained in:
LiangSenCheng 2021-06-24 15:58:02 +00:00
parent 68463aeaf0
commit 0d82f826be

View File

@ -20,3 +20,20 @@ self.addEventListener("fetch", event => {
}), }),
); );
}); });
// eslint-disable-next-line no-restricted-globals
self.addEventListener('activate', function(e) {
e.waitUntil(
Promise.all(
caches.keys().then(cacheNames => {
return cacheNames.map(name => {
if (name !== cacheStorageKey) {
return caches.delete(name)
}
})
})
).then(() => {
return self.clients.claim()
})
)
})