1
0
mirror of https://github.com/moparisthebest/mail synced 2024-11-25 10:22:18 -05:00

Remove redundant case for SW state

This commit is contained in:
Tankred Hase 2015-04-28 14:31:18 +02:00
parent 504e8ffd50
commit bd910df187

View File

@ -52,14 +52,12 @@ function useServiceWorker() {
var installingWorker = registration.installing; var installingWorker = registration.installing;
installingWorker.onstatechange = function() { installingWorker.onstatechange = function() {
switch (installingWorker.state) { if (installingWorker.state === 'installed') {
case 'installed':
if (navigator.serviceWorker.controller) { if (navigator.serviceWorker.controller) {
// At this point, the old content will have been purged and the fresh content will // At this point, the old content will have been purged and the fresh content will
// have been added to the cache. // have been added to the cache.
// It's the perfect time to display a "New content is available; please refresh." // It's the perfect time to display a "New content is available; please refresh."
// message in the page's interface. // message in the page's interface.
console.log('New or updated content is available.');
if (window.confirm(UPDATE_MSG)) { if (window.confirm(UPDATE_MSG)) {
window.location.reload(); window.location.reload();
} }
@ -68,13 +66,8 @@ function useServiceWorker() {
// controlling the page. The service worker will not take control until the next // controlling the page. The service worker will not take control until the next
// reload or navigation to a page under the registered scope. // reload or navigation to a page under the registered scope.
// It's the perfect time to display a "Content is cached for offline use." message. // It's the perfect time to display a "Content is cached for offline use." message.
console.log('Content is cached, and will be available for offline use the ' + console.log('Content is cached, and will be available for offline use the next time the page is loaded.');
'next time the page is loaded.');
} }
break;
case 'redundant':
throw 'The installing service worker became redundant.';
} }
}; };
}; };