async activate()

in workbox-v4.3.1/workbox-precaching.dev.js [371:391]


    async activate() {
      const cache = await caches.open(this._cacheName);
      const currentlyCachedRequests = await cache.keys();
      const expectedCacheKeys = new Set(this._urlsToCacheKeys.values());
      const deletedURLs = [];

      for (const request of currentlyCachedRequests) {
        if (!expectedCacheKeys.has(request.url)) {
          await cache.delete(request);
          deletedURLs.push(request.url);
        }
      }

      {
        printCleanupDetails(deletedURLs);
      }

      return {
        deletedURLs
      };
    }