remove old response() code.

This commit is contained in:
Christopher Jeffrey 2013-07-18 02:01:33 -05:00
parent b46d1161c5
commit 90c9484d8b

View File

@ -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;