1var cacheName = "v2.0.7-1"; 2var filesToCache = ["/", "/index.html"]; 3 4self.addEventListener("install", (event) => { 5 self.skipWaiting(); 6 event.waitUntil( 7 caches.open(cacheName).then((cache) => { 8 return cache.addAll(filesToCache); 9 }) 10 ); 11}); 12 13self.addEventListener("activate", (event) => { 14 event.waitUntil( 15 caches.keys().then((cacheNames) => { 16 return Promise.all( 17 cacheNames 18 .filter((name) => { 19 return name !== cacheName; 20 }) 21 .map((name) => { 22 return caches.delete(name); 23 }) 24 ); 25 }) 26 ); 27}); 28 29self.addEventListener("fetch", function(e) { 30 if (e.request.method == "GET") { 31 let urlObject = new URL(e.request.url); 32 let urlHostName = urlObject.hostname; 33 if ( 34 urlHostName == "vcms.mobiotics.com" || 35 urlObject.pathname.startsWith("/POSTER") == true || 36 urlObject.pathname.startsWith("/css") == true || 37 urlObject.pathname.startsWith("/js") == true || 38 urlObject.pathname.startsWith("/img")
38== true 39 ) { 40 caches.open(cacheName).then(function(cache) { 41 return cache.match(e.request).then(function(response) { 42 var fetchPromise = fetch(e.request).then(function(networkResponse) { 43 if (networkResponse.status == 200) { 44 try { 45 cache.put(e.request, networkResponse.clone()); 46 } catch (e) { 47 console.log("error put"); 48 } 49 } 50 return networkResponse; 51 }); 52 return response || fetchPromise; 53 }); 54 }); 55 } 56 } 57}); 58 59self.addEventListener("notificationclick", function(e) { 60 console.log("DATA -->", e.notification); 61 62 var redirectLink = e.notification.data.action; 63 64 if (redirectLink) { 65 clients.openWindow(redirectLink); 66 } 67 68 e.notification.close(); 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.