import { Injector } from "./Injector"; import { Type, GenericClassDecorator } from "./Util"; import { FrontworkComponent } from "../Types/FrontworkComponent"; /** * @returns {GenericClassDecorator>} * @constructor */ export const Injectable = (_interface?: Type) : GenericClassDecorator> => { return (target: Type) => { Injector.modules.push({ implements: _interface, implementation: target }) } } /** * @returns {GenericClassDecorator>} * @constructor */ export const RootComponent = (config : { injectable : Type injects : Type[] }) : GenericClassDecorator> => { return (target: Type) => { Injector.rootModules = config.injects Injector.rootInterface = config.injectable Injector.root = target } } export const Inject = (type: any) => { return function (_this, key) { Injector.injectionQueue.push({what: type, target: _this, where:key}) } }