- From: jan-ivar <notifications@github.com>
- Date: Thu, 05 Jan 2017 09:37:01 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Thursday, 5 January 2017 17:38:14 UTC
@jakearchibald A controller that is also a promise, is magic. I think that's begging for trouble. I can see SO filling up with questions like: ```js const controller = fetch(url).then(response => …); controller.abort(); // Why is abort undefined??? ``` Also, we should be forward-looking and use async functions in examples IMHO. Today I write: ```js let response = await fetch(...args); ``` Accessing the magic controller would force me to do this: ```js let controller = fetch(...args); let response = await controller; ``` Which again is easy to get wrong: ```js let controller = await fetch(...args); let response = await controller; controller.abort(); // Why is abort undefined??? ``` To `await` or not to `await`? Considering `fetch` is an asynchronous function, and a controller is a promise, I wouldn't blame anyone for getting it 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/whatwg/fetch/issues/447#issuecomment-270706103
Received on Thursday, 5 January 2017 17:38:14 UTC