waitAnyKey
This commit is contained in:
12
waitAnyKey.ts
Normal file
12
waitAnyKey.ts
Normal file
@ -0,0 +1,12 @@
|
||||
export default function waitAnyKey() {
|
||||
console.log('Press any key to continue...');
|
||||
return new Promise(resolve => {
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.resume();
|
||||
process.stdin.once('data', () => {
|
||||
process.stdin.setRawMode(false);
|
||||
process.stdin.pause(); // 在这里添加
|
||||
resolve(undefined);
|
||||
});
|
||||
});
|
||||
}
|
Reference in New Issue
Block a user