File tree 1 file changed +2
-15
lines changed
1 file changed +2
-15
lines changed Original file line number Diff line number Diff line change 7
7
window . addEventListener ( 'load' , function ( ) {
8
8
navigator . serviceWorker . register ( '/sw.js' ) . then ( function ( registration ) { // eslint-disable-line compat/compat
9
9
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
- }
25
10
} ) . catch ( function ( err ) {
26
11
console . log ( 'ServiceWorker registration failed: ' , err )
27
12
} )
28
13
} )
14
+ } else {
15
+ console . log ( 'Service workers are not supported.' )
29
16
}
30
17
} ( ) )
You can’t perform that action at this time.
0 commit comments