1const CACHE_NAME = 'gurukece-cache-v1'; 2const ASSETS_TO_CACHE = [ 3 '/', 4 '/index.html', 5 '/manifest.json', 6 'https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj7lUl7x3DyEa6tllxuATGb0m9cS0dlJXtQCBxAVtf5rIWlg2PktNw6EGLv0CBGtENRTim9-a8L5hpxrapfPXIt-IyTiKz8uwTJ4MNF2Fb4sfx7ts0AdGpxxgufyYoF558rpH1yowxSOOsxXc4ep7vjXvpQzH8ymjCtBvib9O2kUda67R2fVAVoJcyFLJA/s1254/Logo%20Rengganis.png' 7]; 8 9self.addEventListener('install', (event) => { 10 event.waitUntil( 11 caches.open(CACHE_NAME).then((cache) => { 12 return cache.addAll(ASSETS_TO_CACHE); 13 }).then(() => self.skipWaiting()) 14 ); 15}); 16 17self.addEventListener('activate', (event) => { 18 event.waitUntil( 19 caches.keys().then((cacheNames) => { 20 return Promise.all( 21 cacheNames.map((cache) => { 22 if (cache !== CACHE_NAME) { 23 return caches.delete(cache); 24 } 25 }) 26 ); 27 }).then(() => self.clients.claim()) 28 ); 29}); 30 31self.addEventListener('fetch', (event) => { 32 const { request } = event; 33 const url = new URL(request.url); 34 35 // Skip non-GET or API requests 36 if (request.method !== 'GET' || url.pathname.startsWith('/api/')) { 37 event.respondWith(fetch(request)); 38 return; 39 } 40 41 event.respondWith( 42 caches.match(request).then((cachedResponse) => { 43 if (cachedResponse) { 44 // Fetch in background to update cache 45 fetch(request).then((networkResponse) => { 46 if (networkResponse && networkResponse.status === 200) { 47 caches.open(CACHE_NAME).then((cache) => cache.put(request, networkResponse)); 48 } 49 }).catch(() => {}); 50 51 return cachedResponse; 52 } 53 54 return fetch(request).then((networkResponse) => { 55 if (networkResponse && networkResponse.status === 200) { 56 const responseToCache = networkResponse.clone(); 57 caches.open(CACHE_NAME).then((cache) => { 58 cache.put(request, responseToCache); 59 }); 60 } 61 return networkResponse; 62 }).catch(() => { 63 if (request.mode === 'navigate') { 64 return caches.match('/'); 65 } 66 }); 67 }) 68 ); 69});
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.