-
Notifications
You must be signed in to change notification settings - Fork 44
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
Add support for Promises #17
Comments
Sure, why not have Promises too if this is the time to switch to es2015. Feel free to start implementing it but as you pointed out, we need to continue supporting the old API. So I put some deprecation warnings for renamed methods so that they can stay till the v0.3 We can do the same on promises (if possible?) |
I'll wait until you finish the transformation to es2015. Or you 're not planning on doing it for now? Since the change to es2015 or Promises is a huge one, merging it will be hard y we change them separately. I can help you with es2015 if you want. |
I see you already did the transformation. great! |
Yes I did but of course it needs to be tested on a real system. You can directly push your changes. We can test it little more before implementing Promises, maybe in a new branch first? |
I can test were I'm using it. I dont use every function but I could test them. I will try to set a couple of unit tests for test the callback/promise setup |
I Changed it in my repo to using asyn / await !! Check my repo , I've already fixed many bugs : |
What do you think about supporting Promises?
If you dont want to remove callbacks for backwards compatibility, there's a method that could be use to support both
Basically if the user doesn't provide a
callback
aPromise
is return, that way the lib can support bothThere's this library that implements this really easy, and with the advantage that's really easy to remove callbacks and this lib in the future if you want to.
The lib is nodeify
Simple sample:
So in the future if you want to remove callbacks, all you have to do is remove:
var Promise = require('nodeify').Promise;
.nodeify(callback);
what do you think? Promises will make much more friendly and es2015, and allow the use of async/await
The text was updated successfully, but these errors were encountered: