node-webplay
Version:
A nodejs streaming server implementation
87 lines (62 loc) • 2.71 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function es6req(objname) {
var o = require(objname);
if (null == o.default) return o;
return o.default;
}
var ProcMan = function () {
function ProcMan(opt) {
_classCallCheck(this, ProcMan);
//super();
var defop = {
processor: "./index.js",
statusman: "./statmanfs.js"
};
if (null != opt) this.options = Object.assign(defop, opt);else this.options = defop;
var processor = es6req(this.options.processor);
this.statman = es6req(this.options.statusman);
var statopt = Object.assign(this.options, {});
//console.log(statopt, this.processor, this.statman);
this.state = new this.statman(processor, statopt);
}
_createClass(ProcMan, [{
key: "reserve_name",
value: function reserve_name(owner, name) {
return this.state.reserve_name(owner, name);
}
}, {
key: "queue_job",
value: function queue_job(owner, name, file, opt) {
var _this = this;
return new Promise(function (resolve, reject) {
_this.state.queue_job(owner, name, file, opt).then(function () {
return resolve();
}, function (err) {
_this.state.record_error(owner, name, err).then(function () {
return reject(err);
}, function (x) {
return reject(x);
});
});
});
}
}, {
key: "list",
value: function list(owner, opt) {
return this.state.list(owner, opt);
}
}, {
key: "status",
value: function status(owner, id) {
return this.state.status(owner, id);
}
}]);
return ProcMan;
}();
exports.default = ProcMan;
//# sourceMappingURL=procman.js.map