1// PWA App.js 2 3const registerServiceWorker = async () => { 4 let swPath = "/serviceWorker.js"; 5 6 if ("serviceWorker" in navigator) { 7 navigator.serviceWorker 8 .register(swPath, {scope: "/"}) 9 .then((registration) => { 10 // console.log("Registration succeeded."); 11 // registration.unregister().then((boolean) => { 12 // localStorage.clear(); 13 // localStorage.setItem('APP_INSTALLED', '0') 14 // }); 15 // 16 }) 17 .catch((error) => { 18 console.log('Registration failed with ' + error); 19 }); 20 // console.log('End trying Registration Scope'); 21 } 22}; 23 24window.onappinstalled = () => { 25 let xhr = new XMLHttpRequest(); 26 let url = "/pwa-register.php"; 27 28 xhr.setRequestHeader("X-MA-PWA-INSTALL", 'MA1'); 29 30 xhr.onreadystatechange = function() { 31 if (this.readyState === 4 && this.status === 200) { 32 var responseValue = JSON.parse(this.responseText); 33 if(responseValue.status === 200) { 34 // notify in app on success 35 } 36 } 37 }; 38 39 xhr.open("POST", url, true); 40 xhr.send(); 41}; 42 43registerServiceWorker().then(r => {});
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.