1const CACHE_NAME = "my-diet-tracker-v7"; 2const APP_ASSETS = [ 3 "./", 4 "./index.html", 5 "./styles.css", 6 "./app.js", 7 "./manifest.json", 8 "./icons/icon-192.png", 9 "./icons/icon-512.png" 10]; 11 12self.addEventListener("install", (event) => { 13 event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(APP_ASSETS))); 14 self.skipWaiting(); 15}); 16 17self.addEventListener("activate", (event) => { 18 event.waitUntil( 19 caches.keys().then((keys) => Promise.all(keys.filter((key) => key !== CACHE_NAME).map((key) => caches.delete(key)))) 20 ); 21 self.clients.claim(); 22}); 23 24self.addEventListener("fetch", (event) => { 25 if (event.request.method !== "GET") return; 26 event.respondWith( 27 caches.match(event.request).then((cached) => cached || fetch(event.request).then((response) => { 28 const copy = response.clone(); 29 caches.open(CACHE_NAME).then((cache) => cache.put(event.request, copy)); 30 return response; 31 }).catch(() => caches.match("./index.html"))) 32 ); 33});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.