Clear Workbox cache of all content

前端 未结 1 601
陌清茗
陌清茗 2020-12-31 14:22

Using Workbox in a service worker in a javascript webapp. Want to clear the entire workbox/application cache of all content... basically go back to a state as similar as pos

相关标签:
1条回答
  • 2020-12-31 14:45

    CacheStorage is accessible in the client code (where you register the SW) so you can delete it from there.

    caches.keys().then(cacheNames => {
      cacheNames.forEach(cacheName => {
        caches.delete(cacheName);
      });
    });
    
    0 讨论(0)
提交回复
热议问题