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

Here's how I imagined it:

1. ExtendableEvent has a *extensions-allowed* flag which is set
2. After event dispatch, if *extend lifetime promises* is empty, unset *extensions-allowed* & abort these steps
3. Set *extend lifetime promises copy* to a shallow copy of *extend lifetime promises* (the promises themselves don't need to be clones)
4. Wait for all promises in *extend lifetime promises copy*
5. If *extend lifetime promises copy*'s length does not equal *extend lifetime promises* length, goto 3
6. Unset *extensions-allowed*

Calling `respondWith(promise)`:

1. If the dispatch flag is unset, throw (as it already does, just want to be clear that respondWith still needs to be called within the dispatch)
2. Add *promise* to *extend lifetime promises*

Calling `waitUntil(promise)`:

1. If *extensions-allowed* is unset, throw
2. Add *promise* to *extend lifetime promises*

Sorry for the sloppy prose, but does that make sense?

---
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/771#issuecomment-207123053

Received on Thursday, 7 April 2016 22:42:13 UTC