Unverified Commit af34799e authored by XhmikosR's avatar XhmikosR Committed by GitHub
Browse files

Remove page reload in pwa.js. (#24923)

parent 3a0f8d73
6 merge requests!28721Hot test,!27561Adds font-weight-medium to font weight classes,!25494web pack,!25326Adjust examples,!23207#22402 : modal: new autofocus & keyboardBtnNav options,!17021v4
Showing with 2 additions and 15 deletions
+2 -15
...@@ -7,24 +7,11 @@ ...@@ -7,24 +7,11 @@
window.addEventListener('load', function () { window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat
console.log('ServiceWorker registration successful with scope: ', registration.scope) console.log('ServiceWorker registration successful with scope: ', registration.scope)
registration.onupdatefound = function () {
var installingWorker = registration.installing
installingWorker.onstatechange = function () {
switch (installingWorker.state) {
case 'installed':
if (navigator.serviceWorker.controller) { // eslint-disable-line compat/compat
console.log('new update available')
location.reload(true)
}
break
default:
}
}
}
}).catch(function (err) { }).catch(function (err) {
console.log('ServiceWorker registration failed: ', err) console.log('ServiceWorker registration failed: ', err)
}) })
}) })
} else {
console.log('Service workers are not supported.')
} }
}()) }())
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment