Mon 21 Jul 22:43:21 CEST 2025

This commit is contained in:
sbosse 2025-07-21 23:12:11 +02:00
parent c09373e909
commit 6a6fcdf2f8

22
js/term/test.js Normal file
View 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);