- From: Ben Lesh <notifications@github.com>
- Date: Wed, 27 Jan 2016 23:15:06 -0800
- To: whatwg/fetch <fetch@noreply.github.com>
- Message-ID: <whatwg/fetch/issues/27/176024409@github.com>
This is a _lot_ to wade through, so apologies if this has already been answered... But what happens in this scenario? 1. you get a cancelable promise `data` 2. it resolves as expected. 3. then you keep it around because you want the cached value. 4. you call cancel on it: `data.cancel()` 5. you "subscribe" to it again with a `then` call. If it's cancelled after it's resolved, and then you `then` it out again, do you still get the value? What happens if you cancel while processing the resolution? Will the following still log a value? I mean, I'd *think* it would, but I really don't know. ```js cancelablePromise.then(x => { cancelablePromise.cancel(); return x; }).then(x => console.log('here', x)); ``` For all of the times I've derided Promises for not being cancelable, it's the lack of cancellation that is one of Promise's strongest traits. The name even says it, it's a "Promise", it's a guarantee. Adding cancellation would pollute the type and have implications for any "thennable". I think @jhusain was onto something with the idea that it should be a different type. Not necessarily Promise-shaped, and probably not an Observable either. Something more like a single value Observable-type-thing. --- Reply to this email directly or view it on GitHub: https://github.com/whatwg/fetch/issues/27#issuecomment-176024409
Received on Thursday, 28 January 2016 07:15:35 UTC