1if (workbox) { 2 console.log('DEBUG:: Yay! Workbox is loaded ð'); //eslint-disable-line no-console 3} else { 4 console.log("DEBUG:: Boo! Workbox didn't load ð¬"); //eslint-disable-line no-console 5} 6workbox.setConfig({ debug: true }); 7workbox.core.clientsClaim(); 8 9/** 10 * The workboxSW.precacheAndRoute() method efficiently caches and responds to 11 * requests for URLs in the manifest. 12 * See https://goo.gl/S9QRab 13 */ 14self.__precacheManifest = [].concat(self.__precacheManifest || []); 15workbox.precaching.precacheAndRoute(self.__precacheManifest, { 16 ignoreURLParametersMatching: [/.*/] 17}); 18 19workbox.routing.registerNavigationRoute('/index.html', { 20 blacklist: [ 21 // <-- 22 // Makes it possible to create routes that is blacklisted by adding /_myroute & /.shouldnotberouted 23 new RegExp(/^\/_/), 24 new RegExp(/\/[^\/]+\.[^\/]+$/), 25 // --> 26 new RegExp('/api/v1/'), 27 new RegExp('/feeds/'), 28 new RegExp('/images/'), 29 new RegExp('/confirmation/'), 30 new RegExp('/glomt-losenord/') 31 ] 32}); 33 34workbox.routing.registerRoute( 35 /api\/v1\/(?:PageData)/i, 36 new workbox.strategies.NetworkFirst({ 37 cacheName: 'citygross_pagedata_apicache', 38 networkTimeoutSeconds: 10, 39 fetchOptions: { mode: 'cors' }, 40 matchOptions: { ignoreSearch: true }, 41 ignoreURLParametersMatching: [/.*/], 42 plugins: [ 43 new workbox.backgroundSync.Plugin('episerver_pagedata_apisync_queue', { 44 maxRetentionTime: 1440 45 }), 46 new workbox.cacheableResponse.Plugin({ statuses: [0, 200] }), 47 new workbox.broadcastUpdate.Plugin('episerver_pagedata_update_channel') 48 ] 49 }), 50 'GET' 51); 52 53workbox.routing.registerRoute( 54 /api\/v1\/(?:settings)/i, 55 new workbox.strategies.NetworkFirst({ 56 cacheName: 'citygross_sitesettings_apicache', 57 networkTimeoutSeconds: 10, 58 fetchOptions: { mode: 'cors' }, 59 matchOptions: { ignoreSearch: true }, 60 ignoreURLParametersMatching: [/.*/], 61 plugins: [ 62 new workbox.backgroundSync.Plugin( 63 'episerver_sitesettings_apisync_queue', 64 { maxRetentionTime: 1440 } 65 ), 66 new workbox.cacheableResponse.Plugin({ statuses: [0, 200] }), 67 new workbox.broadcastUpdate.Plugin( 68 'episerver_sitesettings_update_channel' 69 ) 70 ] 71 }), 72 'GET' 73); 74 75workbox.routing.registerRoute( 76 /api\/v1\/(?:navigation)/i, 77 new workbox.strategies.NetworkFirst({ 78 cacheName: 'citygross_navigation_apicache', 79 networkTimeoutSeconds: 10, 80 fetchOptions: { mode: 'cors' }, 81 matchOptions: { ignoreSearch: true }, 82 ignoreURLParametersMatching: [/.*/], 83 plugins: [ 84 new workbox.backgroundSync.Plugin('episerver_navigation_apisync_queue', { 85 maxRetentionTime: 1440 86 }), 87 new workbox.cacheableResponse.Plugin({ statuses: [0, 200] }), 88 new workbox.broadcastUpdate.Plugin('episerver_navigation_update_channel') 89 ] 90 }), 91 'GET' 92); 93 94workbox.routing.registerRoute( 95 /api\/v1\/(?:search)/i, 96 new workbox.strategies.NetworkFirst({ 97 cacheName: 'citygross_search_apicache', 98 networkTimeoutSeconds: 10, 99 fetchOptions: { mode: 'cors' }, 100 matchOptions: { ignoreSearch: true }, 101 ignoreURLParametersMatching: [/.*/], 102 plugins: [ 103 new workbox.backgroundSync.Plugin('search_apisync_queue', { 104 maxRetentionTime: 1440 105 }), 106 new workbox.cacheableResponse.Plugin({ statuses: [0, 200] }), 107 new workbox.broadcastUpdate.Plugin('search_update_channel') 108 ] 109 }), 110 'GET' 111); 112 113workbox.routing.registerRoute( 114 /api\/v1\/(?:esales)/i, 115 new workbox.strategies.NetworkFirst({ 116 cacheName: 'citygross_esales_apicache', 117 networkTimeoutSeconds: 10, 118 fetchOptions: { mode: 'cors' }, 119 matchOptions: { ignoreSearch: true }, 120 ignoreURLParametersMatching: [/.*/], 121 plugins: [ 122 new workbox.backgroundSync.Plugin('esales_apisync_queue', { 123 maxRetentionTime: 1440 124 }), 125 new workbox.cacheableResponse.Plugin({ statuses: [0, 200] }), 126 new workbox.broadcastUpdate.Plugin('esales_update_channel') 127 ] 128 }), 129 'GET' 130); 131 132self.addEventListener('message', (messageEvent) => { 133 if (messageEvent.data === 'skipWaiting') {
134 return self.skipWaiting(); 135 } else if (messageEvent.data === 'reloadRequest') { 136 return self.clients.matchAll().then((clients) => { 137 clients.forEach((client) => { 138 client.postMessage('reloadWindow'); 139 }); 140 }); 141 } 142});
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.