Skip to content
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

[readline doc] include line/cursor in readline documentation #30667

Closed
Closed
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
Prev Previous commit
Next Next commit
update results fn to align with standard debounce usage
  • Loading branch information
Js-Brecht committed Dec 2, 2019
commit 5710c4691a0baf815146fc6a47f1b0ffe6f4b4d7
13 changes: 7 additions & 6 deletions doc/api/readline.md
Original file line number Diff line number Diff line change
@@ -373,13 +373,14 @@ One possible use case would be as follows:
```js
const values = ['lorem ipsum', 'dolor sit amet'];
const rl = readline.createInterface(process.stdin);
const showResults = debounce(() => {
console.log(
'\n',
values.filter((val) => val.startsWith(rl.line)).join(' ')
);
}, 300);
process.stdin.on('keypress', (c, k) => {
debounce(() => {
console.log(
'\n',
values.filter((val) => val.startsWith(rl.line)).join(' ')
);
}, 300);
showResults();
});
```