-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Promise.coroutine documentation #1426
Comments
Yeah that documentation is silly. It takes a function that can use yield to yield promises and returns a promise returning function. A PR would be welcome |
Here's the The first sentence may be changed to "Takes a The returned |
@liushigit I'll clarify, I agree that the docs are confusing (and wrong), and if you want to submit a pull request I promise to review it and merge it. |
This is for this [issue](petkaantonov#1426) TODO: The `Promise` by the function returned by the `coroutine` method needs further explanation. A thorough understanding of [the code](https://github.com/petkaantonov/bluebird/blob/4f9093448f55ea76d5a8e090e42fe24b8e0da82c/src/generators.js#L191) is needed.
@benjamingr A PR is added, but I have difficulty explaining the |
@liushigit thanks! I've added some suggestions, LMK what you think |
I'm not sure if this is the right place to ask this question, but what's the difference performance-wise or other, between using coroutines and async/await in node >= 8? Maybe a note should be added to the documentation about it? |
@perrin4869 it's likely async/await is still slower than |
I was confused by the doc for the
coroutine
method, which says the methodMy understanding of this wording is that, this method "returns a function that may (or may not) yield promises".
But in the provided code example, the returned function is only used as a plain function. There's no "yielded promises" from that function. If this is the example for the "may not" case, shall there be an example for the other case?
What I expected was something like
The text was updated successfully, but these errors were encountered: