tsioc
Version:
tsioc is AOP, Ioc container, via typescript decorator
62 lines (60 loc) • 2.58 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
Object.defineProperty(exports, "__esModule", { value: true });
var index_1 = require("./actions/index");
var index_2 = require("./decorators/index");
var ActionFactory = /** @class */ (function () {
function ActionFactory() {
}
/**
* create action by action type. type in 'CoreActions'
*
* @param {string} type
* @returns {ActionComponent}
* @memberof ActionFactory
*/
ActionFactory.prototype.create = function (type) {
var action;
switch (type) {
case index_1.CoreActions.bindParameterType:
action = new index_1.BindParameterTypeAction();
break;
case index_1.CoreActions.bindPropertyType:
action = new index_1.BindPropertyTypeAction();
break;
case index_1.CoreActions.injectProperty:
action = new index_1.InjectPropertyAction();
break;
case index_1.CoreActions.bindProvider:
action = new index_1.BindProviderAction();
break;
case index_1.CoreActions.bindParameterProviders:
action = new index_1.BindParameterProviderAction();
break;
case index_1.CoreActions.componentInit:
action = new index_1.ComponentInitAction();
break;
case index_1.CoreActions.componentBeforeInit:
action = new index_1.ComponentBeforeInitAction();
break;
case index_1.CoreActions.componentCache:
action = new index_1.ComponentCacheAction();
break;
default:
action = new index_1.ActionComposite(type);
break;
}
return action;
};
ActionFactory = __decorate([
index_2.NonePointcut()
], ActionFactory);
return ActionFactory;
}());
exports.ActionFactory = ActionFactory;
//# sourceMappingURL=../sourcemaps/core/ActionFactory.js.map