MCPcopy Create free account
hub / github.com/Monogatari/Monogatari / onLoad

Method onLoad

src/actions/ShowImage.ts:24–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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';

Callers

nothing calls this directly

Calls 6

stateMethod · 0.80
prepareActionMethod · 0.80
willApplyMethod · 0.45
applyMethod · 0.45
didApplyMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected