Re: [w3c/ServiceWorker] async waitUntil() does not allow extension on final promise resolution? (#1039)

To adjust my original example code I think we agreed to this:

```
addEventListener('fetch', evt => {
  // keep alive the SW based on some promise
  let resolveOuterPromise;
  let p = new Promise(resolve => resolveOuterPromise = resolve);
  evt.waitUntil(p);

  // Code can be defined to run on the final keep alive promise resolution that
  // then keeps the SW alive again.
  p.then(_ => {
    // But if there is an extra microtask turn here...
    Promise.then(_ => {
      // Then this should throw.
      evt.waitUntil(fetch(evt.request));
    });
  });

  // promise resolves at some point...
  setTimeout(_ => resolveOuterPromise(), 100);
});
```

So I think queuing a full up task is wrong.

-- 
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/1039#issuecomment-271892473

Received on Wednesday, 11 January 2017 15:08:19 UTC