- From: Andrea Giammarchi <notifications@github.com>
- Date: Mon, 30 Mar 2015 07:21:20 -0700
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/27/87698504@github.com>
providing a canceling mechanism is the only way to go: either (optionally) internally (and that's my favorite, nothing awkward here since it's internally that you resolve or reject) or trough a controller.
Passing a controller around together with a promise in order to cancel seems dumb to me, if you always need boths whhy not just passing a promise with `.cancel` ability ?
If you dont' want any of them why not passing a cancelable promise inside a promise so that no cancelability will be exposed ?
The `await` problem is also half considered ... where is the `catch` in your example?
```js
async function fetchLike(url) {
// where is the catch?
// how do you catch?
var response = await ajax(url);
return response.text;
}
fetchLike("http://some.url.1").then(..);
```
However, if indeed a value is expected, your example will be as easy as hell to go with `.cancel({text:''})`
I also believe if await should do exaclty what Promises do, then we have a redundant pattern impostor
---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-87698504
Received on Monday, 30 March 2015 14:21:42 UTC