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

domenic commented on this pull request.



> +};
+
+self.onactivate = e => {
+  e.waitUntil(caches.keys().then(keys => {
+    return Promise.all(keys.filter(key => key !== cacheKey).map(key => caches.delete(key)));
+  }));
+};
+
+function refreshCacheFromNetworkResponse(req, res) {
+  if (!res.ok) {
+    throw new Error(`${res.url} is responding with ${res.status}`);
+  }
+
+  const resForCache = res.clone();
+
+  // Do not return this promise; it's OK if caching fails, and we don't want to block on it.

Oh fascinating. Will things break if we just pass it to `fetchEvent.waitUntil` for now, and let it just not work until browsers update themselves?

-- 
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:53:50 UTC