UNPKG

beanstalkd

Version:
32 lines (26 loc) 752 B
"use strict"; 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;