showing results for - "pwa clear cache"
Humberto
02 Sep 2018
1if ('serviceWorker' in navigator) {
2  caches.keys().then(function(cacheNames) {
3    cacheNames.forEach(function(cacheName) {
4      caches.delete(cacheName);
5    });
6  });
7}
Juan Pablo
26 Aug 2018
1self.addEventListener('activate', function(event) {
2  event.waitUntil(
3    caches.keys().then(function(cacheNames) {
4      return Promise.all(
5        cacheNames.filter(function(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(function(cacheName) {
10          return caches.delete(cacheName);
11        })
12      );
13    })
14  );
15});
16