Skip to content

Instantly share code, notes, and snippets.

@adrienZ
Last active December 13, 2018 09:59
Show Gist options
  • Select an option

  • Save adrienZ/58039541264e22a53837134c30fe5672 to your computer and use it in GitHub Desktop.

Select an option

Save adrienZ/58039541264e22a53837134c30fe5672 to your computer and use it in GitHub Desktop.
Service worker activation and cache cleaning
self.addEventListener('activate', function(event) {
event.waitUntil(
caches.keys().then(function(cacheNames) {
return Promise.all(
cacheNames.map(function(cacheName) {
return caches.delete(cacheName);
})
);
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment