cujojs / when

A solid, fast Promises/A+ and when() implementation, plus other async goodies.
Other
3.44k stars 396 forks source link

Is there a method to abort a promise? #414

Closed osdio closed 9 years ago

osdio commented 9 years ago

Sometimes , I want to abort a promise, How do it ? Such as : https://github.com/promises-aplus/cancellation-spec/issues/12

briancavalier commented 9 years ago

Hi @soliury, there is no cancel/abort in when.js right now. It's a tricky issue, especially when combining promises with all, race, etc. However, @mjackson and I recently started prototyping some ideas. We're hoping to push it to a branch sometime soon. Stay tuned!

osdio commented 9 years ago

Ok, can you describe the idea of abort promise?

briancavalier commented 9 years ago

@soliury Sure, it's fairly simple. We did some brainstorming recently in a gist: https://gist.github.com/briancavalier/c416d396e844e31c6efa

There are a couple similar but slightly different approaches there, but that should give you an idea of how we are thinking it would work.

briancavalier commented 9 years ago

@soliury I just pushed an initial prototype here: https://github.com/cujojs/when/pull/415

It's nowhere near complete, and there are plenty of things to think about :) Please feel free to jump into the discussion!

briancavalier commented 9 years ago

I think it makes sense to close this issue, since we can track progress in the pull request.