Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created June 20, 2023 06:50
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 YonatanKra/2e69cdd031efb8dbd39f6f9d58ed62fb to your computer and use it in GitHub Desktop.
Save YonatanKra/2e69cdd031efb8dbd39f6f9d58ed62fb to your computer and use it in GitHub Desktop.
async function removeOldCache(event) {
await caches.keys().then(function (keys) {
return Promise.all(keys.filter(function (key) {
return key !== VERSION;
}).map(function (key) {
return caches.delete(key);
}));
}).then(function () {
return self.clients.claim();
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment