@chix/flow
Version:
50 lines • 1.85 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 input_1 = require("./input");
var runPortBox_1 = require("./runPortBox");
var AsyncInputPort = (function (_super) {
__extends(AsyncInputPort, _super);
function AsyncInputPort(portDefinition) {
var _this = _super.call(this, portDefinition) || this;
if (portDefinition.hasOwnProperty('default')) {
_this.setDefault(portDefinition.default);
}
if (portDefinition.context) {
_this.setContext(portDefinition.context);
}
if (!portDefinition.fn) {
throw Error('AsyncInputPort requires a function');
}
_this.reset();
return _this;
}
AsyncInputPort.prototype.isSync = function () {
return false;
};
AsyncInputPort.prototype.isAsync = function () {
return true;
};
AsyncInputPort.prototype.setState = function (state) {
this.state = state;
};
AsyncInputPort.prototype.run = function (params, state) {
this.setState(state);
runPortBox_1.runPortBox.call(this, params);
};
return AsyncInputPort;
}(input_1.InputPort));
exports.AsyncInputPort = AsyncInputPort;
//# sourceMappingURL=asyncInput.js.map