Skip to content

Instantly share code, notes, and snippets.

@EduardoIbarra
Created February 3, 2018 20:13
Show Gist options
  • Save EduardoIbarra/3755f6979e5f9590c313b6fca8b43558 to your computer and use it in GitHub Desktop.
Save EduardoIbarra/3755f6979e5f9590c313b6fca8b43558 to your computer and use it in GitHub Desktop.
self.addEventListener('activate', event => {
const cacheWhitelist = ['nombre-cache-v2'];
event.waitUntil(
caches.keys().then(cacheNames => Promise.all(
cacheNames.map(cacheName => {
if (cacheWhitelist.indexOf(cacheName === -1)) {
return caches.delete(cacheName);
}
})
));
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment