[ServiceWorker] Allow waitUntil to be called multiple times, async (#771)

`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