const staticExamplePWA = 'example-pwa-site-v1'; const assets = [ '/', '/index.html', '/styles.css', '/app.js', '/images/Bear.png', '/images/DeusEx.png', '/images/Face.png', '/images/Tony_Stark.jpg', ]; self.addEventListener('install', (installEvent) => { installEvent.waitUntil( caches.open(staticExamplePWA).then((cache) => { cache.addAll(assets); }), ); }); self.addEventListener('fetch', (fetchEvent) => { fetchEvent.respondWith( caches.match(fetchEvent.request).then((res) => { return res || fetch(fetchEvent.request); }), ); });