Skip to content

Instantly share code, notes, and snippets.

@r17x
Forked from inian/unregister.js
Created February 28, 2018 11:36
Show Gist options
  • Save r17x/822dd75f8c42c4b0b8e141aaef50b1e7 to your computer and use it in GitHub Desktop.
Save r17x/822dd75f8c42c4b0b8e141aaef50b1e7 to your computer and use it in GitHub Desktop.
Unregister all SW registrations
try {
navigator.serviceWorker.getRegistrations().then(function(registrations) {
registrations.forEach(function(registration) {
console.log('removing registration', registration);
registration.unregister();
})
})
}
catch (e) {
console.log('failed to unregister all service workers', e);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment