diff options
author | Rich Trott <rtrott@gmail.com> | 2022-04-03 08:03:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-03 08:03:04 +0300 |
commit | 059b8900093f7468a3598eb307b9842247b29ee7 (patch) | |
tree | a9caa9f7e5a4e77990e028ce82f4769ffb5d511c /doc | |
parent | 302fd02f7140ff06d511eaae807944e335682177 (diff) |
doc: remove util.promisify() content in readline.md
PR-URL: https://github.com/nodejs/node/pull/42552
Reviewed-By: Mestery <mestery@protonmail.com>
Reviewed-By: Tierney Cyren <hello@bnb.im>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/readline.md | 38 |
1 files changed, 0 insertions, 38 deletions
diff --git a/doc/api/readline.md b/doc/api/readline.md index 328af419d87..58a67256104 100644 --- a/doc/api/readline.md +++ b/doc/api/readline.md @@ -355,25 +355,6 @@ signal.addEventListener('abort', () => { setTimeout(() => ac.abort(), 10000); ``` -If this method is invoked as it's util.promisify()ed version, it returns a -Promise that fulfills with the answer. If the question is canceled using -an `AbortController` it will reject with an `AbortError`. - -```js -const util = require('util'); -const question = util.promisify(rl.question).bind(rl); - -async function questionExample() { - try { - const answer = await question('What is you favorite food? '); - console.log(`Oh, so your favorite food is ${answer}`); - } catch (err) { - console.error('Question rejected', err); - } -} -questionExample(); -``` - ### `rl.resume()` <!-- YAML @@ -899,25 +880,6 @@ signal.addEventListener('abort', () => { setTimeout(() => ac.abort(), 10000); ``` -If this method is invoked as it's util.promisify()ed version, it returns a -Promise that fulfills with the answer. If the question is canceled using -an `AbortController` it will reject with an `AbortError`. - -```js -const util = require('util'); -const question = util.promisify(rl.question).bind(rl); - -async function questionExample() { - try { - const answer = await question('What is you favorite food? '); - console.log(`Oh, so your favorite food is ${answer}`); - } catch (err) { - console.error('Question rejected', err); - } -} -questionExample(); -``` - ### `readline.clearLine(stream, dir[, callback])` <!-- YAML |