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

Elephant in the room: the upcoming async keyword #1017

Closed
devinus opened this issue Jan 28, 2016 · 2 comments
Closed

Elephant in the room: the upcoming async keyword #1017

devinus opened this issue Jan 28, 2016 · 2 comments
Labels

Comments

@devinus
Copy link

devinus commented Jan 28, 2016

Any thoughts on what example code using async is going to look like after the async keyword is universal?

@aearly aearly added the question label Feb 2, 2016
@aearly
Copy link
Collaborator

aearly commented Feb 2, 2016

This was discussed a bit in #956 . I think we're going to aim for interop with functions that return promises (e.g. what async functions implicitly do). You'd be able to use an async function in place of a regular callback-using function. Async would then be useful in bridging the gap between async/await/Promise-style code and callback-style code.

@aearly
Copy link
Collaborator

aearly commented Mar 10, 2016

This is a bit clunky, but it would work today, since asyncify adapts functions that return promises:

async.map(someArray, async.asyncify(async function doSomething(item) {
  var foo = await something(item);
  foo.bar = "whatever";
  return foo;
}), callback)

@aearly aearly closed this as completed Mar 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants