Forked from mrienstra/unregisterServiceWorkers.js
Created
September 29, 2018 16:15
-
-
Save ansarizafar/1ccaf3e3a6484a32e7ba4c11aa2a0a0e to your computer and use it in GitHub Desktop.
Unregister service workers, verbose
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' | |
) | |
}) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment