(app: Application, component: Component)
| 110 | * @param component - Component instance |
| 111 | */ |
| 112 | export function mountComponent(app: Application, component: Component) { |
| 113 | if (component.classes) { |
| 114 | for (const classKey in component.classes) { |
| 115 | const binding = createBindingFromClass(component.classes[classKey], { |
| 116 | key: classKey, |
| 117 | }); |
| 118 | app.add(binding); |
| 119 | } |
| 120 | } |
| 121 | |
| 122 | if (component.providers) { |
| 123 | for (const providerKey in component.providers) { |
| 124 | const binding = createBindingFromClass(component.providers[providerKey], { |
| 125 | key: providerKey, |
| 126 | }); |
| 127 | app.add(binding); |
| 128 | } |
| 129 | } |
| 130 | |
| 131 | if (component.bindings) { |
| 132 | for (const binding of component.bindings) { |
| 133 | app.add(binding); |
| 134 | } |
| 135 | } |
| 136 | |
| 137 | if (component.controllers) { |
| 138 | for (const controllerCtor of component.controllers) { |
| 139 | app.controller(controllerCtor); |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | if (component.servers) { |
| 144 | for (const serverKey in component.servers) { |
| 145 | app.server(component.servers[serverKey], serverKey); |
| 146 | } |
| 147 | } |
| 148 | |
| 149 | if (component.lifeCycleObservers) { |
| 150 | for (const observer of component.lifeCycleObservers) { |
| 151 | app.lifeCycleObserver(observer); |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | if (component.services) { |
| 156 | for (const service of component.services) { |
| 157 | app.service(service); |
| 158 | } |
| 159 | } |
| 160 | |
| 161 | if (component.components) { |
| 162 | for (const c of component.components) { |
| 163 | if (c === component) continue; |
| 164 | app.component(c); |
| 165 | } |
| 166 | } |
| 167 | } |
no test coverage detected