clearing all caches that are different to the current cache

This commit is contained in:
Miodec 2022-01-15 20:35:05 +01:00
parent 4486d2348c
commit 4de150422a

View file

@ -1,5 +1,11 @@
const staticCacheName = "sw-cache";
caches.keys().then(function (names) {
for (let name of names) {
if (name !== staticCacheName) caches.delete(name);
}
});
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(staticCacheName).then((cache) => {