-
Notifications
You must be signed in to change notification settings - Fork 109
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
Support promises in addition to continuation-passing #134
Comments
I agree that natively supporting promises would be nice. I'd suggest instead that the configuration parameter be a promise factory. By default it would be |
Promise support would be a nice addition. Why not go the AWS sdk route where each function supports promises as
|
I think it makes more sense to have the callback argument be optional. If not provided, asynchronous methods will return a promise instead. |
I would have agreed to directly return a promise on unprovided callback for a pristine new library but for backward compatibility I think it would be safer to explicitly opt in for a promise. Reason: I think there could be existing cases out in the field where callbacks are not provided which could then potentially lead to |
I don't consider additional warnings to break backwards compatibility, as the program will function the same way in every other respect. In fact, the warnings could be very useful in cases where programs should be handling errors, but are silently ignoring them. |
Any idea if/when this will be done or how can we help?? |
My reasoning for this is to support promises on
Model
methods. Maybe even better idea would be to enable this in some higher configuration.When
promisify: true
all the methods would be wrapped with bluebird'sPromise.promisify()
. I assume this could be done without side effects ininternals.compileModel
withinindex.js
.The other idea is to support both at the same time as it's done in Joi.validate
The text was updated successfully, but these errors were encountered: