tsioc
Version:
tsioc is AOP, Ioc container, via typescript decorator
57 lines (55 loc) • 2.04 kB
JavaScript
;
var __extends = (this && this.__extends) || (function () {
var 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 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 NullAction_1 = require("./NullAction");
var index_1 = require("../../components/index");
var ActionComposite = /** @class */ (function (_super) {
__extends(ActionComposite, _super);
function ActionComposite(name) {
var _this = _super.call(this, name) || this;
_this.children = [];
return _this;
}
ActionComposite.prototype.insert = function (node, index) {
node.parent = this;
if (index < 0) {
index = 0;
}
else if (index >= this.children.length) {
index = this.children.length - 1;
}
this.children.splice(index, 0, node);
return this;
};
ActionComposite.prototype.execute = function (container, data, name) {
if (name) {
this.find(function (it) { return it.name === name; })
.execute(container, data);
}
else {
this.trans(function (action) {
if (action instanceof ActionComposite) {
action.working(container, data);
}
});
}
};
ActionComposite.prototype.empty = function () {
return NullAction_1.NullAction;
};
ActionComposite.prototype.working = function (container, data) {
// do nothing.
};
return ActionComposite;
}(index_1.GComposite));
exports.ActionComposite = ActionComposite;
//# sourceMappingURL=../../sourcemaps/core/actions/ActionComposite.js.map