Skip to content

Instantly share code, notes, and snippets.

@danielpotthast
Created March 19, 2019 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danielpotthast/64f7331f86ea734e2f297efe15760f66 to your computer and use it in GitHub Desktop.
Save danielpotthast/64f7331f86ea734e2f297efe15760f66 to your computer and use it in GitHub Desktop.
// Cleanup old cache storages
self.addEventListener("activate", event => {
event.waitUntil(
caches.keys()
.then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (CACHE_VERSION !== cacheName) {
return caches.delete(cacheName);
}
})
);
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment