- From: Jake Archibald <notifications@github.com>
- Date: Thu, 23 Feb 2017 04:04:23 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 23 February 2017 12:05:30 UTC
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