* Register a function to be called when the application starts. * * This is a shortcut for adding a binding for a LifeCycleObserver * implementing a `start()` method. * * @param fn The function to invoke, it can be synchronous (returning `void`) * or asynchronous (returning `Promis
(fn: () => ValueOrPromise<void>)
| 377 | * @returns The LifeCycleObserver binding created. |
| 378 | */ |
| 379 | public onStart(fn: () => ValueOrPromise<void>): Binding<LifeCycleObserver> { |
| 380 | const key = [ |
| 381 | CoreBindings.LIFE_CYCLE_OBSERVERS, |
| 382 | fn.name || '<onStart>', |
| 383 | generateUniqueId(), |
| 384 | ].join('.'); |
| 385 | |
| 386 | return this.bind<LifeCycleObserver>(key) |
| 387 | .to({start: fn}) |
| 388 | .apply(asLifeCycleObserver); |
| 389 | } |
| 390 | |
| 391 | /** |
| 392 | * Stop the application instance and all of its registered observers. The |
no test coverage detected