1self.addEventListener('activate', (event) => {
2 event.waitUntil(async function() {
3 const cacheNames = await caches.keys();
4 await Promise.all(
5 cacheNames.filter((cacheName) => {
6 // Return true if you want to remove this cache,
7 // but remember that caches are shared across
8 // the whole origin
9 }).map(cacheName => caches.delete(cacheName))
10 );
11 }());
12});