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