From 4de150422acf260367d04dd034abe842e0c56b27 Mon Sep 17 00:00:00 2001 From: Miodec Date: Sat, 15 Jan 2022 20:35:05 +0100 Subject: [PATCH] clearing all caches that are different to the current cache --- static/sw.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/static/sw.js b/static/sw.js index e5496eeba..8a38db25a 100644 --- a/static/sw.js +++ b/static/sw.js @@ -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) => {