diff --git a/resources/private/worker.js b/resources/private/worker.js index 48530fb..ffec69e 100644 --- a/resources/private/worker.js +++ b/resources/private/worker.js @@ -1,7 +1,8 @@ const relatedAppVersion = '1'; // prop:relatedAppVersion const urlsToCache = ["/", "index.html", "js/app.js", "css/styles.css", "img/icon.svg", "manifest.json"]; // prop:urlsToCache -const cacheKey = `resources.${relatedAppVersion}`; +const cacheKeyPrefix = 'nenadalm.life-counter.'; +const cacheKey = `${cacheKeyPrefix}.resources.${relatedAppVersion}`; function ensureHtmlVersionMatches(cache) { return cache.match(new Request('index.html')) @@ -23,6 +24,7 @@ self.addEventListener('install', event => { self.addEventListener('activate', event => { event.waitUntil( caches.keys() + .then(keys => keys.filter(key => key.startsWith(cacheKeyPrefix))) .then(keys => keys.filter(key => key !== cacheKey)) .then(oldKeys => Promise.all(oldKeys.map(key => caches.delete(key)))) );