Created
December 23, 2019 13:27
-
-
Save alexpermiakov/bb11775d881db58f06b3bb1e5d83958b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.addEventListener("activate", e => { | |
e.waitUntil(clearOldCache()); | |
}); | |
const clearOldCache = async () => { | |
const cacheNames = await caches.keys(); | |
const oldCacheName = cacheNames.find(name => name !== CACHE_NAME); | |
caches.delete(oldCacheName); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment