Skip to content

Instantly share code, notes, and snippets.

@albertoperezf
Created December 9, 2017 09:21
Show Gist options
  • Save albertoperezf/2186e64ccc67f5769a42066cbe1cccc4 to your computer and use it in GitHub Desktop.
Save albertoperezf/2186e64ccc67f5769a42066cbe1cccc4 to your computer and use it in GitHub Desktop.
Delete a cache file when a new one is ON with active
self.addEventListener('activate', function(event) {
event.waitUntil(
caches.keys().then(function (cacheNames) {
return Promise.all(
cacheNames.filter(function (cacheNames) {
return cacheNames.startsWith('wittr-') &&
cacheNames !== staticCacheName;
}).map(function (cacheNames) {
return caches.delete(cacheNames);
})
)
}
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment