diff options
Diffstat (limited to 'web/static/sw.js')
-rw-r--r-- | web/static/sw.js | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/web/static/sw.js b/web/static/sw.js index f5d699a..6359ae5 100644 --- a/web/static/sw.js +++ b/web/static/sw.js @@ -1,8 +1,8 @@ const CACHE_PREFIX = 'dartboat-' -const CACHE_VERSION = '3'; +const CACHE_VERSION = '4'; const CACHE_NAME = `${CACHE_PREFIX}${CACHE_VERSION}`; -const FILES = [ +const CACHE_FILES = [ './', 'style.css', 'dartboat.js', @@ -18,19 +18,16 @@ function swlog(str) { self.addEventListener('install', e => { swlog('installing'); - - e.waitUntil((async() => { + e.waitUntil((async () => { swlog(`initialising cache ${CACHE_NAME}`); const cache = await caches.open(CACHE_NAME); - await cache.addAll(FILES); + await cache.addAll(CACHE_FILES); })()); - - swlog('installed'); }); self.addEventListener('activate', e => { - e.waitUntil(caches.keys().then((keys) => { - return Promise.all(keys.map((k) => { + e.waitUntil(caches.keys().then(keys => { + return Promise.all(keys.map(k => { if (k === CACHE_NAME || !k.startsWith(CACHE_PREFIX)) return; |