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

Method onLoad

src/actions/ShowCharacterLayer.ts:29–49  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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

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