mirror of
https://github.com/chjj/blessed.git
synced 2026-02-06 14:11:51 +00:00
refactor listen input and listen output into separate methods.
This commit is contained in:
parent
ef0a6af11a
commit
0cf4934ac1
@ -300,9 +300,6 @@ Program.prototype.listen = function() {
|
||||
var keys = require('./keys')
|
||||
, self = this;
|
||||
|
||||
if (this.input._blessedListened) return;
|
||||
this.input._blessedListened = true;
|
||||
|
||||
// unshiftEvent(process, 'exit', function() {
|
||||
// if (self._originalTitle) {
|
||||
// self.setTitle(self._originalTitle);
|
||||
@ -314,6 +311,17 @@ Program.prototype.listen = function() {
|
||||
// self._originalTitle = data.text;
|
||||
// });
|
||||
|
||||
this._listenInput();
|
||||
this._listenOutput();
|
||||
};
|
||||
|
||||
Program.prototype._listenInput = function() {
|
||||
var keys = require('./keys')
|
||||
, self = this;
|
||||
|
||||
if (this.input._blessedListened) return;
|
||||
this.input._blessedListened = true;
|
||||
|
||||
// Input
|
||||
this.input.on('keypress', function(ch, key) {
|
||||
key = key || { ch: ch };
|
||||
@ -370,6 +378,10 @@ Program.prototype.listen = function() {
|
||||
self.bindMouse();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Program.prototype._listenOutput = function() {
|
||||
var self = this;
|
||||
|
||||
if (this.output._blessedListened) return;
|
||||
this.output._blessedListened = true;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user