1
0
Fork 0
mirror of https://github.com/twbs/bootstrap.git synced 2022-11-09 12:25:43 -05:00

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

This commit is contained in:
XhmikosR 2017-12-05 13:21:16 +02:00 committed by GitHub
parent 3a0f8d73df
commit af34799eda
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,24 +7,11 @@
window.addEventListener('load', function () {
navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat
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) {
console.log('ServiceWorker registration failed: ', err)
})
})
} else {
console.log('Service workers are not supported.')
}
}())