Last active
April 28, 2021 04:38
-
-
Save karimsa/a7f847dfc777adbd0d19ed9f5cd1bcaf to your computer and use it in GitHub Desktop.
Reset service workers
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
self.addEventListener('install', function(e) { | |
self.skipWaiting(); | |
}); | |
self.addEventListener('activate', function(e) { | |
self.registration.unregister() | |
.then(function() { | |
return self.clients.matchAll(); | |
}) | |
.then(function(clients) { | |
clients.forEach(client => client.navigate(client.url)) | |
}) | |
.then(() => location.reload()); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment