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

Replace AsyncHandle with a proper Promise implementation #71

Closed
dtao opened this issue Feb 24, 2014 · 5 comments
Closed

Replace AsyncHandle with a proper Promise implementation #71

dtao opened this issue Feb 24, 2014 · 5 comments

Comments

@dtao
Copy link
Owner

dtao commented Feb 24, 2014

No description provided.

@FrozenCow
Copy link
Contributor

So I did some searching:

I wasn't aware of this, but ES6 will get promises natively: http://www.html5rocks.com/en/tutorials/es6/promises/
It'll use the Promise/A+ standard. So it's a good idea to pick a library that can work as a drop-in for the native one, in Node as well as the browser.

Here are a few:
https://github.com/then/promise
https://github.com/cujojs/when
https://github.com/MaxMotovilov/node-promise
https://github.com/kriskowal/q

Most promising ones seem then/promise and cujojs/when. Both are made to work in browser as well as node, both seem to focus on compliance with Promise/A+, both seem fairly minimal and fast. It does seem cujojs has a longer history, so it might be safer to go for that. I haven't used any of them consciously, so I'm only looking at their descriptions at this time.

@dtao
Copy link
Owner Author

dtao commented Apr 3, 2014

So I actually decided to get a bit crazy and implemented the Promises/A+ spec myself, in Lazy, which means Lazy.AsyncHandle is now a compliant promise (passes all 872 tests, phew!). My motivations were twofold:

  1. I prefer to keep Lazy 100% free of dependencies (somewhat an arbitrary goal, I know—but it makes me feel good, anyway).
  2. I thought it'd be fun to take a stab at implementing the spec.

This will be in the next release, which I'm now thinking will probably be 0.4.0 as there have been quite a few changes since 0.3.2.

@FrozenCow
Copy link
Contributor

Nice! Looking forward to the release. 0.4.0 does indeed sound good for what it brings.

@hyzhak
Copy link

hyzhak commented Jun 29, 2014

👍 for Promises/A+

@dtao
Copy link
Owner Author

dtao commented Dec 13, 2014

Done in 0.4.0!

@dtao dtao closed this as completed Dec 13, 2014
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

3 participants