Skip to content

Instantly share code, notes, and snippets.

View michaelaflores's full-sized avatar

Michael Flores michaelaflores

View GitHub Profile
@michaelaflores
michaelaflores / unregisterServiceWorkers.js
Created April 17, 2022 08:36 — forked from mrienstra/unregisterServiceWorkers.js
Unregister service workers, verbose
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' : '') +