| 22 | } |
| 23 | |
| 24 | static override async onLoad(): Promise<void> { |
| 25 | const images = this.engine.state('images') as string[]; |
| 26 | const promises: Promise<void>[] = []; |
| 27 | |
| 28 | for (const item of images) { |
| 29 | const action = this.engine.prepareAction(item, { cycle: 'Application' }) as ActionInstance | null; |
| 30 | if (action !== null) { |
| 31 | const promise = (async () => { |
| 32 | await action.willApply(); |
| 33 | await action.apply(); |
| 34 | await action.didApply({ updateHistory: false, updateState: false }); |
| 35 | })(); |
| 36 | |
| 37 | promises.push(promise); |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | if (promises.length > 0) { |
| 42 | await Promise.all(promises); |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | static override matchString([show, type]: string[]): boolean { |
| 47 | return show === 'show' && type === 'image'; |