1'use strict'; 2const cacheName = 'banglacinema100.com-digiPWA-1.0.1'; 3const startPage = 'https://banglacinema100.com'; 4 5const offlinePage0 = 'https://banglacinema100.com/about-us/'; 6const offlinePage1 = 'https://banglacinema100.com/movie-view/'; 7const offlinePage2 = 'https://banglacinema100.com/all-personaties-details/'; 8const offlinePage3 = 'https://banglacinema100.com/banglaCinema-gallery-film/'; 9const offlinePage4 = 'https://banglacinema100.com/banglaCinema-gallery-event/'; 10 11const filesToCache = [startPage, offlinePage0 , offlinePage1 , offlinePage2 , offlinePage3 , offlinePage4 , 'https://banglacinema100.com/assets/img/bc1001.png','https://banglacinema100.com/assets/img/bc1002.png','https://banglacinema100.com/assets/img/slider/banner4.jpg','https://banglacinema100.com/assets/img/slider/2.png','https://banglacinema100.com/assets/img/slider/2.png','https://banglacinema100.com/assets/img/slider/1.png']; 12const neverCacheUrls = [/\/adminlogin/, /\/admincbdigi/]; 13self.addEventListener('install', function(e) { 14 console.log('digiPWA service worker installation'); 15 e.waitUntil(caches.open(cacheName).then(function(cache) { 16 console.log('digiPWA service worker caching dependencies'); 17 filesToCache.map(function(url) { 18 return cache.add(url).catch(function(reason) { 19 return console.log('digiPWA: ' + String(reason) + ' ' + url); 20 }); 21 }); 22 })); 23}); 24self.addEventListener('activate', function(e) { 25 console.log('digiPWA service worker activation'); 26 e.waitUntil(caches.keys().then(function(keyList) { 27 return Promise.all(keyList.map(function(key) { 28 if (key !== cacheName) { 29 console.log('digiPWA old cache removed', key); 30 return caches.delete(key); 31 } 32 })); 33 })); 34 return self.clients.claim(); 35}); 36self.addEventListener('fetch', function(e) { 37 if (!neverCacheUrls.every(checkNeverCacheList, e.request.url)) { 38 console.log('digiPWA: Current request is excluded from cache.'); 39 return; 40 } 41 if (!e.request.url.match(/^(http|https):\/\//i)) 42 return; 43 if (new URL(e.request.url).origin !== location.origin) 44 return; 45 if (e.request.method !== 'GET') { 46 e.respondWith(fetch(e.request).catch(function() { 47 return caches.match(offlinePage); 48 })); 49 return; 50 } 51 if (e.request.mode === 'navigate' && navigator.onLine) { 52 e.respondWith(fetch(e.request).then(function(response) { 53 return caches.open(cacheName).then(function(cache) { 54 cache.put(e.request, response.clone()); 55 return response; 56 }); 57 })); 58 return; 59 } 60 e.respondWith(caches.match(e.request).then(function(response) { 61 return response || fetch(e.request).then(function(response) { 62 return caches.open(cacheName).then(function(cache) { 63 cache.put(e.request, response.clone()); 64 return response; 65 }); 66 }); 67 }).catch(function() { 68 return caches.match(offlinePage); 69 })); 70}); 71function checkNeverCacheList(url) { 72 if (this.match(url)) { 73 return false; 74 } 75 return true; 76}
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.