diff options
Diffstat (limited to 'ui')
| -rw-r--r-- | ui/service-worker.js | 36 | ||||
| -rw-r--r-- | ui/static/manifest.json | 24 |
2 files changed, 34 insertions, 26 deletions
diff --git a/ui/service-worker.js b/ui/service-worker.js index e2143b3..9855a73 100644 --- a/ui/service-worker.js +++ b/ui/service-worker.js @@ -15,29 +15,29 @@ import { build, files, version } from '$service-worker'; const CACHE = `cache-${version}`; const ASSETS = [ - ...build, // the app itself - ...files // everything in `static` + ...build, // the app itself + ...files // everything in `static` ]; self.addEventListener('install', (event) => { - // Create a new cache and add all files to it - async function addFilesToCache() { - const cache = await caches.open(CACHE); - await cache.addAll(ASSETS); - } + // Create a new cache and add all files to it + async function addFilesToCache() { + const cache = await caches.open(CACHE); + await cache.addAll(ASSETS); + } - event.waitUntil(addFilesToCache()); + event.waitUntil(addFilesToCache()); }); self.addEventListener('activate', (event) => { - // Remove previous cached data from disk - async function deleteOldCaches() { - for (const key of await caches.keys()) { - if (key !== CACHE) await caches.delete(key); - } - } - - event.waitUntil(deleteOldCaches()); + // Remove previous cached data from disk + async function deleteOldCaches() { + for (const key of await caches.keys()) { + if (key !== CACHE) await caches.delete(key); + } + } + + event.waitUntil(deleteOldCaches()); }); // The simplest possible use of the caches above: @@ -47,8 +47,8 @@ async function cacheFirst(request) { return responseFromCache; } return fetch(request); -}; +} -self.addEventListener("fetch", (event) => { +self.addEventListener('fetch', (event) => { event.respondWith(cacheFirst(event.request)); }); diff --git a/ui/static/manifest.json b/ui/static/manifest.json index 29e3e90..938955e 100644 --- a/ui/static/manifest.json +++ b/ui/static/manifest.json @@ -9,35 +9,43 @@ "icons": [ { "src": "/favicon.png", - "type": "image/png", "sizes": "72x72" + "type": "image/png", + "sizes": "72x72" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "96x96" + "type": "image/png", + "sizes": "96x96" }, { "src": "/favicon.png", - "type": "image/png","sizes": "128x128" + "type": "image/png", + "sizes": "128x128" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "144x144" + "type": "image/png", + "sizes": "144x144" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "152x152" + "type": "image/png", + "sizes": "152x152" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "192x192" + "type": "image/png", + "sizes": "192x192" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "384x384" + "type": "image/png", + "sizes": "384x384" }, { "src": "/favicon.png", - "type": "image/png", "sizes": "512x512" + "type": "image/png", + "sizes": "512x512" } ] } |
