delete old service worker caches
This commit is contained in:
parent
32a55d00b2
commit
6fdc430c4f
|
@ -80,9 +80,15 @@ async function decryptStream(id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
async function precache() {
|
async function precache() {
|
||||||
|
const oldCaches = await caches.keys();
|
||||||
|
for (const c of oldCaches) {
|
||||||
|
if (c !== version) {
|
||||||
|
await caches.delete(c);
|
||||||
|
}
|
||||||
|
}
|
||||||
const cache = await caches.open(version);
|
const cache = await caches.open(version);
|
||||||
const x = assets.match(/.*\.(png|svg|jpg)$/);
|
const images = assets.match(/.*\.(png|svg|jpg)$/);
|
||||||
await cache.addAll(x);
|
await cache.addAll(images);
|
||||||
return self.skipWaiting();
|
return self.skipWaiting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue