September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,12 +1,29 @@
|
|||
var keypress = require('keypress');
|
||||
|
||||
keypress(process.stdin);
|
||||
|
||||
process.stdin.on('keypress', function (ch, key) {
|
||||
if (key && (key.name === 'y' || key.name === 'n')) {
|
||||
console.log('Reply:' + key.name);
|
||||
}
|
||||
});
|
||||
|
||||
const readline = require('readline');
|
||||
readline.emitKeypressEvents(process.stdin);
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.resume();
|
||||
|
||||
var wait_key = async function() {
|
||||
return await new Promise(function(resolve,reject) {
|
||||
var key_listen = function(str,key) {
|
||||
process.stdin.removeListener('keypress', key_listen);
|
||||
resolve(str);
|
||||
}
|
||||
process.stdin.on('keypress', key_listen);
|
||||
});
|
||||
}
|
||||
|
||||
var done = function() {
|
||||
process.exit();
|
||||
}
|
||||
|
||||
var go = async function() {
|
||||
do {
|
||||
console.log('Press any key...');
|
||||
var key = await wait_key();
|
||||
console.log("Key pressed is",key);
|
||||
await new Promise(function(resolve) { setTimeout(resolve,1000); });
|
||||
} while(key != 'y');
|
||||
done();
|
||||
}
|
||||
|
||||
go();
|
||||
|
|
|
|||
|
|
@ -1,6 +1,12 @@
|
|||
document.body.addEventListener('keyup', function (e) {
|
||||
var key = String.fromCharCode(e.keyCode).toLowerCase();
|
||||
if (key === 'y' || key === 'n') {
|
||||
console.log('response is: ' + key);
|
||||
}
|
||||
}, false);
|
||||
var keypress = require('keypress');
|
||||
|
||||
keypress(process.stdin);
|
||||
|
||||
process.stdin.on('keypress', function (ch, key) {
|
||||
if (key && (key.name === 'y' || key.name === 'n')) {
|
||||
console.log('Reply:' + key.name);
|
||||
}
|
||||
});
|
||||
|
||||
process.stdin.setRawMode(true);
|
||||
process.stdin.resume();
|
||||
|
|
|
|||
|
|
@ -0,0 +1,6 @@
|
|||
document.body.addEventListener('keyup', function (e) {
|
||||
var key = String.fromCharCode(e.keyCode).toLowerCase();
|
||||
if (key === 'y' || key === 'n') {
|
||||
console.log('response is: ' + key);
|
||||
}
|
||||
}, false);
|
||||
Loading…
Add table
Add a link
Reference in a new issue