mirror of
https://github.com/embarklabs/neo-blessed.git
synced 2025-02-02 06:07:36 +00:00
remove old response() code.
This commit is contained in:
parent
b46d1161c5
commit
90c9484d8b
@ -1073,43 +1073,6 @@ Program.prototype.receive = function(text, callback) {
|
||||
});
|
||||
};
|
||||
|
||||
Program.prototype.response_ = function(name, text, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = text;
|
||||
text = name;
|
||||
name = null;
|
||||
}
|
||||
|
||||
if (!callback) {
|
||||
callback = function() {};
|
||||
}
|
||||
|
||||
var listeners = (this._events && this._events['keypress']) || []
|
||||
, bak = listeners.slice()
|
||||
, self = this;
|
||||
|
||||
if (!this.input.isRaw) {
|
||||
throw new Error('Input must be raw.');
|
||||
}
|
||||
|
||||
listeners.length = 0;
|
||||
|
||||
return process.nextTick(function() {
|
||||
self.input.once('data', function(data) {
|
||||
listeners.push.apply(listeners, bak);
|
||||
self.once('response' + (name ? ' ' + name : ''), function(event) {
|
||||
if (event.type === 'error') {
|
||||
return callback(new Error(event.event + ': ' + event.text));
|
||||
}
|
||||
return callback(null, event);
|
||||
});
|
||||
self._bindResponse(data);
|
||||
});
|
||||
|
||||
if (text) self.write(text);
|
||||
});
|
||||
};
|
||||
|
||||
Program.prototype.response = function(name, text, callback) {
|
||||
if (arguments.length === 2) {
|
||||
callback = text;
|
||||
|
Loading…
x
Reference in New Issue
Block a user