beanstalkd
Version:
A beanstalkd client for Node.js with promises
32 lines (26 loc) • 752 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BasicWriter = exports.Writer = undefined;
var _bluebird = require("bluebird");
class Writer {
constructor(command) {
this.command = command;
}
}
exports.Writer = Writer;
class BasicWriter extends Writer {
handle(protocol, connection) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
var _this = this;
return (0, _bluebird.coroutine)(function* () {
yield new Promise(function (resolve) {
connection.write(protocol.buildCommand(_this.command, args), resolve);
});
})();
}
}
exports.BasicWriter = BasicWriter;