Closed
Description
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:
self.onfetch = event => {
event.respondWith(doSomeThingToGetResponse().then(response => {
event.waitUntil(doSomeCleanup);
return response;
}))
};