Mon 21 Jul 22:43:21 CEST 2025
This commit is contained in:
parent
c09373e909
commit
6a6fcdf2f8
22
js/term/test.js
Normal file
22
js/term/test.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
// Test TTY raw mode
|
||||
process.stdout.write('hello world\n');
|
||||
console.log(process.stdout.columns+' * '+process.stdout.rows);
|
||||
console.log('Setting raw mode ..')
|
||||
process.stdin.setRawMode(true);
|
||||
console.log('Installing event listener .. ')
|
||||
process.stdin.on('keypress',function (ch,key) {
|
||||
console.log('X: '+ch+' <'+key+'>');
|
||||
});
|
||||
process.stdin.on('data',function (ch) {
|
||||
var key={};
|
||||
console.log('D: '+key+' <'+ch.length+'>');
|
||||
for(var i=0;i<ch.length;i++) console.log(ch[i]);
|
||||
process.stdin.emit('keypress', ch, key);
|
||||
});
|
||||
process.stdin.emit('keypress', {}, 'c');
|
||||
console.log('Waiting ..')
|
||||
setTimeout(function () {
|
||||
console.log('DONE');
|
||||
process.stdin.setRawMode(false);
|
||||
process.exit();
|
||||
},2000);
|
Loading…
Reference in New Issue
Block a user