forked from snxraven/sshChat-CLI
moving events to where they make sense
This commit is contained in:
parent
7d3ab3e2ee
commit
6390750ae5
45
sshChat.js
45
sshChat.js
@ -52,6 +52,27 @@ const screen = blessed.screen({
|
||||
fastCSR: true
|
||||
});
|
||||
|
||||
// Quit on Escape, q, or Control-C.
|
||||
screen.key(['escape', 'q', 'C-c'], function (ch, key) {
|
||||
console.log("Sending close message...")
|
||||
for (let conn of conns) {
|
||||
conn.write(`CLOSED: ${publicKey.toString('hex')}`)
|
||||
}
|
||||
(async () => {
|
||||
|
||||
await sleep(2000)
|
||||
process.exit()
|
||||
|
||||
})();
|
||||
|
||||
});
|
||||
|
||||
let scrollCount = 0
|
||||
|
||||
// Return to chat
|
||||
screen.key(['t', 'enter'], function (ch, key) {
|
||||
stdinBox.focus();
|
||||
});
|
||||
|
||||
// Debug ONLY
|
||||
// screen.on('keypress', function(ch, key){
|
||||
@ -312,26 +333,4 @@ stdinBox.on('submit', (input) => {
|
||||
stdinBox.focus();
|
||||
// Render the screen
|
||||
|
||||
screen.render()
|
||||
|
||||
// Quit on Escape, q, or Control-C.
|
||||
screen.key(['escape', 'q', 'C-c'], function (ch, key) {
|
||||
console.log("Sending close message...")
|
||||
for (let conn of conns) {
|
||||
conn.write(`CLOSED: ${publicKey.toString('hex')}`)
|
||||
}
|
||||
(async () => {
|
||||
|
||||
await sleep(2000)
|
||||
process.exit()
|
||||
|
||||
})();
|
||||
|
||||
});
|
||||
|
||||
let scrollCount = 0
|
||||
|
||||
// Return to chat
|
||||
screen.key(['t', 'enter'], function (ch, key) {
|
||||
stdinBox.focus();
|
||||
});
|
||||
screen.render()
|
Loading…
Reference in New Issue
Block a user