- From: Asa Kusuma <notifications@github.com>
- Date: Tue, 30 Oct 2018 15:54:43 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 30 October 2018 22:55:04 UTC
Given the current API, I believe you're supposed to schedule the `cache.put` using `waitUntil`. Not sure if this is actually necessary given the browser implementations, but probably best practice: ```JavaScript const fromNetwork = fetch(url); event.waitUntil(fromNetwork.then((response) => { return cache.put(url, response); })); event.respondWith(fromNetwork.then(response => { return response.clone(); })); ``` Either way, seems like a common enough pattern to warrant some syntactic sugar. -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1367#issuecomment-434499403
Received on Tuesday, 30 October 2018 22:55:04 UTC