* | 1 | 1 | 1 | * | -------- | -------- | -------- | * | modified | redoable | undoable |
()
| 168 | * | modified | redoable | undoable | |
| 169 | */ |
| 170 | getState(): number { |
| 171 | const { cursor } = this.session; |
| 172 | let state = 7; |
| 173 | // undoable ? |
| 174 | if (cursor <= 0) { |
| 175 | state -= 1; |
| 176 | } |
| 177 | // redoable ? |
| 178 | if (cursor >= this.records.length - 1) { |
| 179 | state -= 2; |
| 180 | } |
| 181 | // modified ? |
| 182 | if (this.point === cursor) { |
| 183 | state -= 4; |
| 184 | } |
| 185 | return state; |
| 186 | } |
| 187 | |
| 188 | /** |
| 189 | * 监听 state 变更事件 |
no outgoing calls
no test coverage detected