- From: Jake Archibald <notifications@github.com>
- Date: Wed, 28 Oct 2015 01:08:29 -0700
- To: slightlyoff/ServiceWorker <ServiceWorker@noreply.github.com>
Received on Wednesday, 28 October 2015 08:09:00 UTC
`waitUntil` must be called before returning to the event loop, but it may be called after that if one of its promises hasn't resolved.
`respondWith` should compose with this, and count as having called `waitUntil` in the initial turn. As in:
```js
self.onfetch = event => {
event.respondWith(doSomeThingToGetResponse().then(response => {
event.waitUntil(doSomeCleanup);
return response;
}))
};
```
---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/771
Received on Wednesday, 28 October 2015 08:09:00 UTC