From af34799eda8d0ed92462cf277610a57e8610be88 Mon Sep 17 00:00:00 2001 From: XhmikosR Date: Tue, 5 Dec 2017 13:21:16 +0200 Subject: [PATCH] Remove page reload in pwa.js. (#24923) --- assets/js/src/pwa.js | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/assets/js/src/pwa.js b/assets/js/src/pwa.js index 5e1a43b085..3484f05b04 100644 --- a/assets/js/src/pwa.js +++ b/assets/js/src/pwa.js @@ -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.') } }())