From 520707abaad09afcaea6c31f4426409dd9951d2f Mon Sep 17 00:00:00 2001 From: Favyen Bastani Date: Sat, 4 Jul 2015 17:23:32 -0400 Subject: [PATCH] Fix event listener loss on terminal reset. --- wssh/static/term.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/wssh/static/term.js b/wssh/static/term.js index 9489334..606ec43 100644 --- a/wssh/static/term.js +++ b/wssh/static/term.js @@ -131,7 +131,8 @@ function Terminal(cols, rows, handler) { this.rows = rows || Terminal.geometry[1]; if (handler) { - this.on('data', handler); + this.dataHandler = handler; + this.on('data', this.dataHandler); } this.ybase = 0; @@ -2432,7 +2433,7 @@ Terminal.prototype.reverseIndex = function() { // ESC c Full Reset (RIS). Terminal.prototype.reset = function() { - Terminal.call(this, this.cols, this.rows); + Terminal.call(this, this.cols, this.rows, this.dataHandler); this.refresh(0, this.rows - 1); };