]> git.ipfire.org Git - thirdparty/bootstrap.git/commitdiff
Remove page reload in pwa.js. (#24923)
authorXhmikosR <xhmikosr@gmail.com>
Tue, 5 Dec 2017 11:21:16 +0000 (13:21 +0200)
committerGitHub <noreply@github.com>
Tue, 5 Dec 2017 11:21:16 +0000 (13:21 +0200)
assets/js/src/pwa.js

index 5e1a43b085c58d0daa25c637bd1d2fea388be7e9..3484f05b04d6ecc645c83896524e6050cdefb507 100644 (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.')
   }
 }())