Improved www.ttss.krakow.pl
Jacek Kowalski
2017-05-14 434151b5b3368920dc7add2a28d8da172cb70060
Do not call skipWaiting on inactive service worker
1 files modified
4 ■■■ changed files
serviceworker-install.js 4 ●●● patch | view | raw | blame | history
serviceworker-install.js
@@ -2,7 +2,9 @@
    window.addEventListener('load', function() {
        navigator.serviceWorker.register('/serviceworker.js').then(function(registration) {
            console.log('Service Worker registration successful. ', registration);
            navigator.serviceWorker.controller.postMessage({action: 'skipWaiting'});
            if(navigator.serviceWorker.controller) {
                navigator.serviceWorker.controller.postMessage({action: 'skipWaiting'});
            }
        }).catch(function(err) {
            console.log('Service Worker registration failed. ', err);
        });