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

Normalize all user-provided functions to promise via utility method internally #102

Open
scotthovestadt opened this issue Feb 13, 2016 · 3 comments

Comments

@scotthovestadt
Copy link
Contributor

To ensure that all async user-provided functions can use either a callback or a promise, a utility method should be created that normalizes everything into returning a promise. It'll simplify the code.

We may also want to consider using Babel's async/await to further simplify the code.

@dthree Thoughts?

@dthree
Copy link
Owner

dthree commented Feb 13, 2016

I agree with standardizing it. Additionally, it would be good to consistently permit an optional sync response as well (simply by the user not passing in a callback to the method).

However, isn't async/await ES7 experimental? Not sure I want to get into that.

@scotthovestadt
Copy link
Contributor Author

Yeah, it's ES7... but probably the most widely used experimental feature in the history of JavaScript. You should play with it. It changes everything.

You can setup Babel to compile it to generators, which are a part of NodeJS now.

@dthree
Copy link
Owner

dthree commented Feb 14, 2016

I'll check it out.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment