Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
doc: fix question promise API example
  • Loading branch information
meixg committed Mar 25, 2022
commit 8cf372617f8133ead7a543a1dd0a02d631f85559
6 changes: 3 additions & 3 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,14 +618,14 @@ Using an `AbortController` to cancel a question.
const ac = new AbortController();
const signal = ac.signal;
Comment thread
aduh95 marked this conversation as resolved.
Resolved

const answer = await rl.question('What is your favorite food? ', { signal });
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);
Comment thread
aduh95 marked this conversation as resolved.
Resolved

const answer = await rl.question('What is your favorite food? ', { signal });
console.log(`Oh, so your favorite food is ${answer}`);
```

### Class: `readlinePromises.Readline`
Expand Down