Re: [whatwg/fetch] Aborting a fetch: The Next Generation (#447)

How useful is the separation of controller & signal? They could be rolled into one, simplifying the API. The only thing you'd lose is the ability to pass the signal around without the controller.

How this would look in a page:

```js
const controller = new FetchController();

fetch(url, {controller});
```

And in a service worker:

```js
addEventListener('fetch', event => {
  event.respondWith(async function () {
    
    const texts = [url1, url2, url3].map(url =>
      fetch(url, { controller: event.controller }).then(r => r.text())
    );

    const fullText = (await Promise.all(texts)).join('');

    return Response(fullText);
  }());
});
```

Would need to figure out how the controller worked in both the service worker & client. It could be a new controller created using an internal signal, or it could represent the same controller.

We can probably drop `follow` & `unfollow` in this model.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/447#issuecomment-281974648

Received on Thursday, 23 February 2017 12:05:30 UTC