Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tasks: single-consumer not-quite-promises #13

Open
domenic opened this issue Sep 14, 2014 · 1 comment
Open

Tasks: single-consumer not-quite-promises #13

domenic opened this issue Sep 14, 2014 · 1 comment

Comments

@domenic
Copy link
Member

domenic commented Sep 14, 2014

@kriskowal makes the case here: https://github.com/kriskowal/gtor/blob/master/cancelation.md

After thinking on this for a while, it's pretty elegant. By re-using the .then interface, they can be converted to promises easily (via Promise.resolve(theTask)), which makes them multicast.

@nathan7 and I were talking about this at NodeConf EU; tagging him in.

@edef1c
Copy link

edef1c commented Sep 14, 2014

The big question here imo is whether we should make them thenables, or have explicit conversion with a Task<T>#toPromise() → Promise<T>
Maintaining the cancelability of a task even if it is returned asynchronously seems like a useful property to me.
The interface proposed by @kriskowal is literally the same thing we came up with (sans the ETA stuff), so that's probably what we should go for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants