* Start the application, and all of its registered observers. The application * state is checked to ensure the integrity of `start`. * * If the application is not initialized, it calls first `init()` to * initialize the application. This only happens if `start()` is called for * the f
()
| 353 | * If the application is already started, no operation is performed. |
| 354 | */ |
| 355 | public async start(): Promise<void> { |
| 356 | if (!this._initialized) await this.init(); |
| 357 | if (this._state === 'starting') return this.awaitState('started'); |
| 358 | this.assertNotInProcess('start'); |
| 359 | // No-op if it's started |
| 360 | if (this._state === 'started') return; |
| 361 | this.setState('starting'); |
| 362 | this.setupShutdown(); |
| 363 | |
| 364 | const registry = await this.getLifeCycleObserverRegistry(); |
| 365 | await registry.start(); |
| 366 | this.setState('started'); |
| 367 | } |
| 368 | |
| 369 | /** |
| 370 | * Register a function to be called when the application starts. |