()
| 101 | } |
| 102 | |
| 103 | override async revert(): Promise<void> { |
| 104 | // return this.engine.run (this.engine.history ('image').pop (), false); |
| 105 | const history = this.engine.history('image') as string[]; |
| 106 | for (let i = history.length - 1; i >= 0; i--) { |
| 107 | const last = history[i]; |
| 108 | const [, , asset] = last.split(' '); |
| 109 | if (asset === this.asset) { |
| 110 | const action = this.engine.prepareAction(last, { cycle: 'Application' }) as import('../lib/types').ActionInstance | null; |
| 111 | if (action !== null) { |
| 112 | await action.willApply(); |
| 113 | await action.apply(); |
| 114 | await action.didApply({ updateHistory: false, updateState: true }); |
| 115 | } |
| 116 | return; |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | throw new Error('Could not find a previous state to revert to'); |
| 121 | } |
| 122 | |
| 123 | override async didRevert(): Promise<ActionRevertResult> { |
| 124 | return { advance: true, step: true }; |
nothing calls this directly
no test coverage detected