Created
March 29, 2018 07:11
-
-
Save jacky810124/25753322cd47cb5f17e279b0e21cabbf to your computer and use it in GitHub Desktop.
PWA Day06 - remove outdate cache
This file contains hidden or 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', function(event) { | |
| event.waitUntil( | |
| caches | |
| .keys() | |
| .then(function(cacheNames) { | |
| return Promise.all( | |
| cacheNames | |
| .filter(function(cacheName) { | |
| // Return true if you want to remove this cache, | |
| // but remember that caches are shared across | |
| // the whole origin | |
| }) | |
| .map(function(cacheName) { | |
| return caches.delete(cacheName) | |
| }) | |
| ) | |
| }) | |
| ) | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment