forked from oyd/ozgurkon-2020-site
replace old service-worker file with a new one that unregister all of them See merge request devfest-toulouse/site-devfest-2019!10master
commit
321648bab2
@ -0,0 +1,21 @@ |
|||||||
|
"use strict"; |
||||||
|
|
||||||
|
if ('serviceWorker' in navigator) { |
||||||
|
navigator.serviceWorker.getRegistrations().then(function (registrations) { |
||||||
|
if (!registrations.length) { |
||||||
|
console.log('No serviceWorker registrations found.') |
||||||
|
return |
||||||
|
} |
||||||
|
for (let registration of registrations) { |
||||||
|
registration.unregister().then(function (boolean) { |
||||||
|
console.log( |
||||||
|
(boolean ? 'Successfully unregistered' : 'Failed to unregister'), 'ServiceWorkerRegistration\n' + |
||||||
|
(registration.installing ? ' .installing.scriptURL = ' + registration.installing.scriptURL + '\n' : '') + |
||||||
|
(registration.waiting ? ' .waiting.scriptURL = ' + registration.waiting.scriptURL + '\n' : '') + |
||||||
|
(registration.active ? ' .active.scriptURL = ' + registration.active.scriptURL + '\n' : '') + |
||||||
|
' .scope: ' + registration.scope + '\n' |
||||||
|
) |
||||||
|
}) |
||||||
|
} |
||||||
|
}); |
||||||
|
} |
Loading…
Reference in new issue