Skip to content

Commit

Permalink
Update headBegin.ejs
Browse files Browse the repository at this point in the history
  • Loading branch information
MHuiG authored Nov 3, 2023
1 parent 5c92575 commit 3102dcc
Showing 1 changed file with 33 additions and 33 deletions.
66 changes: 33 additions & 33 deletions source/_volantis/headBegin.ejs
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
<script>
/////////////////////////////// serviceWorker ///////////////////////////////////////////
function registerServiceWorker(path) {
if (window.location.hostname != "localhost") {
"serviceWorker" in navigator && navigator.serviceWorker.register(`${path}?time=${new Date().getTime()}`).then(function (n) {
n.onupdatefound = function () {
var e = n.installing;
e.onstatechange = function () {
switch (e.state) {
case "installed":
navigator.serviceWorker.controller ?
console.log("Updated Service Worker.") :
console.log("Service Worker Sucess!");
break;
case "redundant":
console.log("The installing service worker became redundant.")
}
}
}
}).catch(function (e) {
console.error("Error during service worker registration:", e)
if (typeof swinstallretry === 'undefined') {
swinstallretry = 1;
registerServiceWorker(`/volantis-sw.js`)
}
});
}
}
registerServiceWorker(`/volantis-sw.js`)
//function registerServiceWorker(path) {
// if (window.location.hostname != "localhost") {
// "serviceWorker" in navigator && navigator.serviceWorker.register(`${path}?time=${new Date().getTime()}`).then(function (n) {
// n.onupdatefound = function () {
// var e = n.installing;
// e.onstatechange = function () {
// switch (e.state) {
// case "installed":
// navigator.serviceWorker.controller ?
// console.log("Updated Service Worker.") :
// console.log("Service Worker Sucess!");
// break;
// case "redundant":
// console.log("The installing service worker became redundant.")
// }
// }
// }
// }).catch(function (e) {
// console.error("Error during service worker registration:", e)
// if (typeof swinstallretry === 'undefined') {
// swinstallretry = 1;
// registerServiceWorker(`/volantis-sw.js`)
// }
// });
// }
//}
//registerServiceWorker(`/volantis-sw.js`)
//////////////////////////////////////////////////////////////////////////
//// unregister serviceWorker
// if ('serviceWorker' in navigator) {
// navigator.serviceWorker.ready.then(registration => {
// registration.unregister();
// });
// }
if ('serviceWorker' in navigator) {
navigator.serviceWorker.ready.then(registration => {
registration.unregister();
});
}
//////////////////////////////////////////////////////////////////////////
</script>
</script>

0 comments on commit 3102dcc

Please sign in to comment.