Skip to content

Commit

Permalink
Chore: update recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
mdonnalley committed Mar 20, 2024
1 parent 607c972 commit 914564b
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/prompts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,18 +205,20 @@ import { input } from '@inquirer/prompts';

const ac = new AbortController();
const {signal} = ac;
const answer = input(...);
const prompt = input(...);

let answer;

setTimeout(5000, 'timeout', {signal})
.catch(() => {})
.then(() => {
answer.cancel();
return defaultValue;
prompt.cancel();
answer = defaultValue;
})

return answer.then((value) => {
await prompt.then((value) => {
ac.abort()
return value
answer = value
})
```

Expand Down

0 comments on commit 914564b

Please sign in to comment.