Skip to content

Instantly share code, notes, and snippets.

@thepassle
Created October 28, 2019 14:18
Show Gist options
  • Save thepassle/b7921f750de94af44654ffd90f1a6868 to your computer and use it in GitHub Desktop.
Save thepassle/b7921f750de94af44654ffd90f1a6868 to your computer and use it in GitHub Desktop.
lifecycle6
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames
.filter(cacheName => cacheName.startsWith('my-cache-v')
&& cacheName !== CACHENAME)
.map(cacheName => caches.delete(cacheName))
)
})
)
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment