Created
February 2, 2021 08:48
-
-
Save Accudio/68f2b1f8b816d9a343d04de1ce06ca78 to your computer and use it in GitHub Desktop.
Delete all caches from within service-worker
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('activate', event => { | |
event.waitUntil( | |
caches.keys().then(allCaches => { | |
return Promise.all(allCaches.map(cacheToDelete => { | |
return caches.delete(cacheToDelete); | |
})); | |
}).then(() => self.clients.claim()) | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment