Re: [fetch] Aborting a fetch (#27)

> If I understand correctly, `finally` introduces a third state

Kinda. "cancelled" would be the third state.

> You said canceled won't call `onfullfill` neither `onreject` so I assume it will be resolved silently through `onfinally`, is this correct?

To the outside observer, yes. So you'd write:

```js
showSpinner();
fetch(url).then(r => r.json())
.then(displayData)
.catch(showError)
.finally(hideSpinner);
```

If the fetch errors, an error is shown and the spinner stops. If the fetch succeeds the data is displayed and the spinner stops. If the fetch is cancelled the spinner stops.

> I also read your answer as "it won't happen any time soon"

I'm not sure what your timelines are, but it won't be rushed into.

> Last question would be: you mentioned `CancelablePromise` again

The token approach may be able to be added to `Promise`, but I think adding `.cancel` to `Promise` could break existing code.

> wouldn't be better to just move away from Promises and bring Tasks natively in?

Could you point to a implementation of tasks you're particularly fond of?

---
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/27#issuecomment-93011058

Received on Tuesday, 14 April 2015 18:35:08 UTC