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

Method reset

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

Source from the content-addressed store, hash-verified

83 }
84
85 static override async reset(): Promise<void> {
86 const promises: Promise<any>[] = [];
87
88 // Go through each canvas element being shown so it can be properly
89 // stopped and then removed.
90 this.engine.element().find('[data-component="canvas-container"]').each((canvasContainer: any) => {
91 const { object } = canvasContainer.props;
92
93 promises.push(Util.callAsync(object.stop, this.engine, canvasContainer.layers, object.props, object.state, canvasContainer).then(() => {
94 canvasContainer.remove();
95 }));
96 });
97
98 this.engine.history({
99 canvas: []
100 });
101
102 this.engine.state({
103 canvas: []
104 });
105
106 await Promise.all(promises);
107 }
108
109 static override matchString([show, type]: string[]): boolean {
110 return show === 'show' && type === 'canvas';

Callers

nothing calls this directly

Calls 6

historyMethod · 0.80
stateMethod · 0.80
eachMethod · 0.65
removeMethod · 0.65
elementMethod · 0.45
allMethod · 0.45

Tested by

no test coverage detected