(newState)
| 9000 | return { ...this.state, mode: this.state.modes[this.state.currentModeIndex] }; |
| 9001 | } |
| 9002 | setState(newState) { |
| 9003 | const oldState = { ...this.state }; |
| 9004 | if (newState.mode) { |
| 9005 | newState.currentModeIndex = this.state.modes.indexOf(newState.mode); |
| 9006 | } |
| 9007 | this.state = { ...this.state, ...newState }; |
| 9008 | this._notifyStateChange(oldState, this.state); |
| 9009 | if (this.container) { |
| 9010 | this.render(this.container); |
| 9011 | } |
| 9012 | } |
| 9013 | onStateChange(handler) { |
| 9014 | this.onStateChangeHandlers.push(handler); |
| 9015 | return () => { |
no test coverage detected