UNPKG

type-autofac

Version:

tsioc is AOP, Ioc container, via typescript decorator

44 lines (42 loc) 2.01 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 index_1 = require("../../core/index"); var index_2 = require("../../utils/index"); var AopActions_1 = require("./AopActions"); var RegistAspectAction = /** @class */ (function (_super) { __extends(RegistAspectAction, _super); function RegistAspectAction() { return _super.call(this, AopActions_1.AopActions.registAspect) || this; } RegistAspectAction.prototype.working = function (container, data) { var target = data.target; var type = data.targetType; var propertyKey = data.propertyKey; var lifeScope = container.getLifeScope(); var matchs = lifeScope.getClassDecorators(function (surm) { return surm.actions.includes(AopActions_1.AopActions.registAspect) && index_1.hasOwnClassMetadata(surm.name, type); }); var aspectMgr = container.get(index_2.symbols.IAdvisor); matchs.forEach(function (surm) { var metadata = index_1.getOwnTypeMetadata(surm.name, type); if (Array.isArray(metadata) && metadata.length > 0) { metadata.forEach(function (meta) { if (index_2.isClass(meta.type)) { aspectMgr.add(meta.type); } }); } }); }; return RegistAspectAction; }(index_1.ActionComposite)); exports.RegistAspectAction = RegistAspectAction; //# sourceMappingURL=../../sourcemaps/aop/actions/RegistAspectAction.js.map