1if ('serviceWorker' in navigator) { 2 window.addEventListener('DOMContentLoaded', function () { 3 navigator.serviceWorker.register('/serviceWorker.js').then(function (registration) { 4 console.log('ServiceWorker registration successful with scope: ', registration.scope); 5 const sw = registration.installing || registration.waiting 6 if (sw) { 7 sw.onstatechange = function() { 8 if (sw.state === 'installed') { 9 // SW installed. Reload for SW intercept serving SW-enabled page. 10 console.log('ServiceWorker installed reload page'); 11 window.location.reload(); 12 } 13 } 14 } 15 registration.update().then(res => { 16 console.log('ServiceWorker registration update: ', res); 17 }); 18 window._SW_ENABLED = true 19 }, function (err) { 20 console.error('ServiceWorker registration failed: ', err); 21 }); 22 navigator.serviceWorker.addEventListener('controllerchange', function() { 23 console.log('ServiceWorker controllerchange '); 24 window.location.reload(true); 25 }); 26 }); 27}
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.