“PWA Clear Cache” Kode Jawaban

PWA Clear Cache

if ('serviceWorker' in navigator) {
  caches.keys().then(function(cacheNames) {
    cacheNames.forEach(function(cacheName) {
      caches.delete(cacheName);
    });
  });
}
Shadow

PWA Clear Cache

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);
        })
      );
    })
  );
});
Shadow

Jawaban yang mirip dengan “PWA Clear Cache”

Pertanyaan yang mirip dengan “PWA Clear Cache”

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya