Re: [whatwg/streams] Meta: add a service worker to the spec (#637)

domenic commented on this pull request.



> +        const networkFetchPromise = fetch(e.request);
+
+        // Ignore network fetch or caching errors; they just mean we won't be able to refresh the cache.
+        networkFetchPromise
+          .then(res => refreshCacheFromNetworkResponse(e.request, res))
+          .catch(() => {});
+
+        return cachedResponse || networkFetchPromise;
+      })
+    );
+  }
+};
+
+self.onactivate = e => {
+  e.waitUntil(caches.keys().then(keys => {
+    return Promise.all(keys.filter(key => key !== cacheKey).map(key => caches.delete(key)));

Yep :)

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/streams/pull/637

Received on Wednesday, 4 January 2017 15:51:43 UTC