UNPKG

tsioc

Version:

tsioc is AOP, Ioc container, via typescript decorator

47 lines (45 loc) 1.99 kB
"use strict"; 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 CoreActions_1 = require("./CoreActions"); var ActionComposite_1 = require("./ActionComposite"); /** * bind property vaule action. * * @export * @class SetPropAction * @extends {ActionComposite} */ var InjectPropertyAction = /** @class */ (function (_super) { __extends(InjectPropertyAction, _super); function InjectPropertyAction() { return _super.call(this, CoreActions_1.CoreActions.injectProperty) || this; } InjectPropertyAction.prototype.working = function (container, data) { if (!data.execResult) { this.parent.find(function (act) { return act.name === CoreActions_1.CoreActions.bindPropertyType; }).execute(container, data); } if (data.target && data.execResult && data.execResult.length) { data.execResult.forEach(function (prop, idx) { if (prop) { var token = prop.provider ? container.getToken(prop.provider, prop.alias) : prop.type; if (container.has(token)) { data.target[prop.propertyKey] = container.resolve.apply(container, [token].concat((data.providers || []))); } } }); } }; return InjectPropertyAction; }(ActionComposite_1.ActionComposite)); exports.InjectPropertyAction = InjectPropertyAction; //# sourceMappingURL=../../sourcemaps/core/actions/InjectPropertyAction.js.map