Skip to content

Instantly share code, notes, and snippets.

@oahehc
Created September 30, 2020 03:46
Show Gist options
  • Save oahehc/dd760a97cfdef34b386aae213f7275cc to your computer and use it in GitHub Desktop.
Save oahehc/dd760a97cfdef34b386aae213f7275cc to your computer and use it in GitHub Desktop.
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((cacheNames) => {
const promiseArr = cacheNames.map((item) => {
if (item !== CACHE_NAME) {
return caches.delete(item);
}
});
return Promise.all(promiseArr);
})
);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment