Shim in dataHandler for toggling from elsewhere

This commit is contained in:
Bryan Ashby 2020-05-18 00:33:14 -06:00
parent e517e31b94
commit a1ac6dfc67
1 changed files with 16 additions and 3 deletions

View File

@ -35,9 +35,11 @@ class TelnetClient {
this.clientReady();
}, 3000);
this.socket.on('data', data => {
this.dataHandler = function(data) {
this.emit('data', data);
});
}.bind(this);
this.socket.on('data', this.dataHandler);
this.socket.on('error', err => {
// :TODO: Log me
@ -79,7 +81,14 @@ class TelnetClient {
});
this.socket.on('WONT', command => {
// :TODO: see telnet.js handling
switch (command.option) {
case Options.NEW_ENVIRON :
return this.socket.dont.new_environ();
default :
// :TODO: Log me
break;
}
});
this.socket.on('SB', command => {
@ -143,6 +152,10 @@ class TelnetClient {
this.banner();
}
// dataHandler(data) {
// this.emit('data', data);
// }
clientReady() {
if (this.clientReadyHandled) {
return; // already processed