* Register a function to be called when the application initializes. * * This is a shortcut for adding a binding for a LifeCycleObserver * implementing a `init()` method. * * @param fn The function to invoke, it can be synchronous (returning `void`) * or asynchronous (returning `Pr
(fn: () => ValueOrPromise<void>)
| 331 | * @returns The LifeCycleObserver binding created. |
| 332 | */ |
| 333 | public onInit(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver> { |
| 334 | const key = [ |
| 335 | CoreBindings.LIFE_CYCLE_OBSERVERS, |
| 336 | fn.name || '<onInit>', |
| 337 | generateUniqueId(), |
| 338 | ].join('.'); |
| 339 | |
| 340 | return this.bind<LifeCycleObserver>(key) |
| 341 | .to({init: fn}) |
| 342 | .apply(asLifeCycleObserver); |
| 343 | } |
| 344 | |
| 345 | /** |
| 346 | * Start the application, and all of its registered observers. The application |
no test coverage detected