* Transition the application to a new state and emit an event * @param state - The new state
(state: string)
| 287 | * @param state - The new state |
| 288 | */ |
| 289 | protected setState(state: string) { |
| 290 | const oldState = this._state; |
| 291 | this._state = state; |
| 292 | if (oldState !== state) { |
| 293 | this.emit('stateChanged', {from: oldState, to: this._state}); |
| 294 | this.emit(state); |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | protected async awaitState(state: string) { |
| 299 | await once(this, state); |