zents
Version:
ZenTS is a Node.js & TypeScript MVC-Framework for building rich web applications, released as free and open-source software under the MIT License. It is designed for building web applications with modern tools and design patterns.
29 lines • 1.16 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ControllerFactory = void 0;
const template_1 = require("../template/");
const AbstractFactory_1 = require("../core/AbstractFactory");
class ControllerFactory extends AbstractFactory_1.AbstractFactory {
constructor(controllers, emailFactory, sessionFactory, securityProviders, databaseContainer, templateData) {
super();
this.controllers = controllers;
const templateLoader = new template_1.Loader(templateData.files);
this.templateEnvironment = new template_1.Environment(templateLoader, templateData);
this.injector = this.buildInjector({
databaseContainer,
emailFactory,
securityProviders,
sessionFactory,
});
}
build(key) {
const controller = this.controllers.get(key);
if (!controller) {
return null;
}
const instance = this.injector.inject(controller.module, [this.templateEnvironment]);
return instance;
}
}
exports.ControllerFactory = ControllerFactory;
//# sourceMappingURL=ControllerFactory.js.map