-
Notifications
You must be signed in to change notification settings - Fork 29.7k
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
doc: improve util.promisify() content in readline.md #42552
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we want to recommend using util.promisify
over the "built-in" promisified alternative.
doc/api/readline.md
Outdated
Use [`util.promisify()`][] to create a version that returns a | ||
promise that fulfills with the answer. If the question is canceled using | ||
an `AbortController` it will reject with an `AbortError`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use [`util.promisify()`][] to create a version that returns a | |
promise that fulfills with the answer. If the question is canceled using | |
an `AbortController` it will reject with an `AbortError`. | |
Don't use [`util.promisify()`][] to create a version that returns a | |
promise that fulfills with the answer, use `require('readline/promises').createInterface` instead. If the question is canceled using | |
an `AbortController` it will reject with an `AbortError`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can also recommend AbortSignal.timeout()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there's a documented promise API, I think we can just delete all the text, or replace it with something like "See [other API][] for a promise-based version of this API."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, removing it could make sense indeed. Worth noting that promise API is still marked as experimental and not available on Node.js <17, so we could expect a large chunk of our users would prefer to rely on util.promisify
. Folks who want to support older release lines should check the documentation of the older release line.
Content removed entirely. Does that work well enough, @aduh95? |
Landed in 059b890 |
PR-URL: nodejs#42552 Reviewed-By: Mestery <[email protected]> Reviewed-By: Tierney Cyren <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: #42552 Reviewed-By: Mestery <[email protected]> Reviewed-By: Tierney Cyren <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
PR-URL: nodejs#42552 Reviewed-By: Mestery <[email protected]> Reviewed-By: Tierney Cyren <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
No description provided.