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

Method onLoad

src/actions/Canvas.ts:38–65  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 }
37
38 static override async onLoad(): Promise<void> {
39 const state = this.engine.state('canvas');
40
41 if (state.length === 0) {
42 return;
43 }
44
45 const promises = [];
46 for (const canvas of state) {
47 const action: ActionInstance | null = this.engine.prepareAction(canvas, { cycle: 'Application' });
48
49 if (action === null) {
50 continue;
51 }
52
53 const promise = action.willApply().then(() => {
54 return action.apply().then(() => {
55 return action.didApply({ updateHistory: false, updateState: false });
56 });
57 });
58
59 promises.push(promise);
60 }
61
62 if (promises.length > 0) {
63 await Promise.all(promises);
64 }
65 }
66
67 static override async setup(): Promise<void> {
68 this.engine.history('canvas');

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