Created
September 20, 2017 08:22
-
-
Save deanhume/4b7e1f136cbee288cff9f0fc46318fbb to your computer and use it in GitHub Desktop.
Clear Service Worker Cache
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
if ('serviceWorker' in navigator) { | |
caches.keys().then(function(cacheNames) { | |
cacheNames.forEach(function(cacheName) { | |
caches.delete(cacheName); | |
}); | |
}); | |
} |
Thanks this worked for me
same for me thanks
thank u , this code work after new release.
i'm using of service worker.
If you're using async/await:
if ('serviceWorker' in navigator) {
for (const key of await caches.keys()) {
await caches.delete(key);
}
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! :)