Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntoine du Hamel <duhamelantoine1995@gmail.com>2022-09-14 22:10:53 +0300
committerGitHub <noreply@github.com>2022-09-14 22:10:53 +0300
commit481a959adbda695622a15aac9506a3fc0feee739 (patch)
tree842a17c477dd72868e30ba0fed7e3e86b98b9b92 /doc/api/readline.md
parent5ec2c9900722470d47a2e41294d08b60a6016a3b (diff)
readline: remove `question` method from `InterfaceConstructor`
That method is overwritten in both `require('node:readline').Interface.prototype` and `require('node:readline/promises').Interface.prototype`, and is very much not useful outside of interacting with TTY, removing it from the parent class could enable the use of `InterfaceConstructor` in other contexts (such as interacting with files). PR-URL: https://github.com/nodejs/node/pull/44606 Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'doc/api/readline.md')
-rw-r--r--doc/api/readline.md55
1 files changed, 0 insertions, 55 deletions
diff --git a/doc/api/readline.md b/doc/api/readline.md
index 443d89f8b49..b4ac0b3bf5f 100644
--- a/doc/api/readline.md
+++ b/doc/api/readline.md
@@ -303,61 +303,6 @@ paused.
If the `InterfaceConstructor` was created with `output` set to `null` or
`undefined` the prompt is not written.
-### `rl.question(query[, options], callback)`
-
-<!-- YAML
-added: v0.3.3
--->
-
-* `query` {string} A statement or query to write to `output`, prepended to the
- prompt.
-* `options` {Object}
- * `signal` {AbortSignal} Optionally allows the `question()` to be canceled
- using an `AbortController`.
-* `callback` {Function} A callback function that is invoked with the user's
- input in response to the `query`.
-
-The `rl.question()` method displays the `query` by writing it to the `output`,
-waits for user input to be provided on `input`, then invokes the `callback`
-function passing the provided input as the first argument.
-
-When called, `rl.question()` will resume the `input` stream if it has been
-paused.
-
-If the `InterfaceConstructor` was created with `output` set to `null` or
-`undefined` the `query` is not written.
-
-The `callback` function passed to `rl.question()` does not follow the typical
-pattern of accepting an `Error` object or `null` as the first argument.
-The `callback` is called with the provided answer as the only argument.
-
-An error will be thrown if calling `rl.question()` after `rl.close()`.
-
-Example usage:
-
-```js
-rl.question('What is your favorite food? ', (answer) => {
- console.log(`Oh, so your favorite food is ${answer}`);
-});
-```
-
-Using an `AbortController` to cancel a question.
-
-```js
-const ac = new AbortController();
-const signal = ac.signal;
-
-rl.question('What is your favorite food? ', { signal }, (answer) => {
- console.log(`Oh, so your favorite food is ${answer}`);
-});
-
-signal.addEventListener('abort', () => {
- console.log('The food question timed out');
-}, { once: true });
-
-setTimeout(() => ac.abort(), 10000);
-```
-
### `rl.resume()`
<!-- YAML