Skip to content

Commit af34799

Browse files
authored
Remove page reload in pwa.js. (#24923)
1 parent 3a0f8d7 commit af34799

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

assets/js/src/pwa.js

+2-15
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,11 @@
77
window.addEventListener('load', function () {
88
navigator.serviceWorker.register('/sw.js').then(function (registration) { // eslint-disable-line compat/compat
99
console.log('ServiceWorker registration successful with scope: ', registration.scope)
10-
registration.onupdatefound = function () {
11-
var installingWorker = registration.installing
12-
installingWorker.onstatechange = function () {
13-
switch (installingWorker.state) {
14-
case 'installed':
15-
if (navigator.serviceWorker.controller) { // eslint-disable-line compat/compat
16-
console.log('new update available')
17-
location.reload(true)
18-
}
19-
break
20-
21-
default:
22-
}
23-
}
24-
}
2510
}).catch(function (err) {
2611
console.log('ServiceWorker registration failed: ', err)
2712
})
2813
})
14+
} else {
15+
console.log('Service workers are not supported.')
2916
}
3017
}())

0 commit comments

Comments
 (0)