From c82e40caa38edf02ebda49be6ce42afb0e0907c4 Mon Sep 17 00:00:00 2001 From: Owen Jacobson Date: Mon, 11 Nov 2024 23:04:35 -0500 Subject: npm run format --- ui/service-worker.js | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'ui/service-worker.js') 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)); }); -- cgit v1.2.3