(state: InputHistoryState)
| 23 | } |
| 24 | |
| 25 | push (state: InputHistoryState) { |
| 26 | // if current index points before the last element then remove the future |
| 27 | if (this.currentIndex < this.states.length - 1) this.states.length = this.currentIndex + 1; |
| 28 | this.states.push(state); |
| 29 | if (this.states.length > InputHistory.MAX_LENGTH) this.states.shift(); |
| 30 | this.currentIndex = this.states.length - 1; |
| 31 | } |
| 32 | |
| 33 | go (steps: number): InputHistoryState | undefined { |
| 34 | this.currentIndex = Math.min(Math.max(this.currentIndex + steps, 0), this.states.length - 1); |
no test coverage detected