@chix/flow
Version:
61 lines • 2.42 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var _debug = require("debug");
var common_1 = require("../common");
var events_1 = require("../events");
var util_1 = require("../util");
var export_1 = require("./export");
var nodebox_1 = require("./nodebox");
var output_1 = require("./output");
var ports_1 = require("./ports");
var debug = _debug('chix:node');
function $RunOnce(Base) {
return (function (_super) {
__extends(RunOnce$, _super);
function RunOnce$() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.active = false;
return _this;
}
RunOnce$.prototype._runOnce = function () {
var _this = this;
var t = setTimeout(function () {
debug('%s: node timeout', _this.identifier);
_this.event(events_1.NodeEvents.TIMEOUT, {
node: _this.export(),
});
}, this.nodeTimeout);
this.event(events_1.NodeEvents.START, {
node: this.export(),
});
this.nodebox.run();
this.state = this.nodebox.state;
debug('%s:%s executed', this.identifier, this.nodebox.fn.name);
clearTimeout(t);
this.active = false;
this._output(this.nodebox.output);
};
return RunOnce$;
}(Base));
}
exports.$RunOnce = $RunOnce;
(function ($RunOnce) {
function create(Base) {
return util_1.mixin($RunOnce, common_1.$Event.create, export_1.$Export.create, common_1.$Identity.create, nodebox_1.$Nodebox.create, output_1.$Output.create, ports_1.$Ports.create)(Base);
}
$RunOnce.create = create;
})($RunOnce = exports.$RunOnce || (exports.$RunOnce = {}));
//# sourceMappingURL=runOnce.js.map