Created
June 3, 2021 01:36
-
-
Save niksmac/d80452d0a94acb5473c547f2247f13ea to your computer and use it in GitHub Desktop.
Clear service worker cache from browser
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
caches.keys().then(function (cachesNames) { | |
console.log("Delete " + document.defaultView.location.origin + " caches"); | |
return Promise.all(cachesNames.map(function (cacheName) { | |
return caches.delete(cacheName).then(function () { | |
console.log("Cache with name " + cacheName + " is deleted"); | |
}); | |
})) | |
}).then(function () { | |
console.log("All " + document.defaultView.location.origin + " caches are deleted"); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment