1const CACHE_NAME = 'cache-v2'; 2const urlsToCache = [ 3 '/index.html', 4 '/main.js', 5 '/favicon.ico', 6 '/icons/icon-48x48.png', 7 '/icons/icon-72x72.png', 8 '/icons/icon-96x96.png', 9 '/icons/icon-128x128.png', 10 '/icons/icon-144x144.png', 11 '/icons/icon-152x152.png', 12 '/icons/icon-192x192.png', 13 '/icons/icon-384x384.png', 14 '/icons/icon-512x512.png', 15]; 16 17self.addEventListener('install', event => { 18 event.waitUntil( 19 caches.open(CACHE_NAME) 20 .then(cache => cache.addAll(urlsToCache)) 21 .then(() => console.log('Cache successfully initialized')) 22 .catch(error => console.log('Cache initialization failed:', error)) 23 ); 24}); 25 26self.addEventListener('fetch', event => { 27 event.respondWith( 28 caches.match(event.request) 29 .then(response => { 30 if (response) { 31 return response; 32 } 33 return fetch(event.request); 34 }) 35 .catch(error => console.log('Fetch error:', error)) 36 ); 37}); 38 39self.addEventListener('activate', event => { 40 event.waitUntil( 41 caches.keys().then(cacheNames => { 42 return Promise.all( 43 cacheNames.map(cacheName => { 44 if (cacheName !== CACHE_NAME) { 45 return caches.delete(cacheName); 46 } 47 }) 48 ); 49 }) 50 ); 51});
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.