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

Function goBack

src/engine/ui.ts:390–408  ·  view source on GitHub ↗
(engine: VisualNovelEngine, event: Event, selector: string)

Source from the content-addressed store, hash-verified

388}
389
390export function goBack (engine: VisualNovelEngine, event: Event, selector: string): void {
391 if (!$_(`${selector} [data-screen="game"]`).isVisible ()) {
392 engine.debug.debug ('Registered Back Listener on Non-Game Screen');
393 event.stopImmediatePropagation ();
394 event.stopPropagation ();
395 event.preventDefault ();
396 hideScreens (engine);
397
398 type ComponentWithState = HTMLElement & { setState: (state: Record<string, unknown>) => void };
399
400 if (engine.global ('playing') || engine.global ('on_splash_screen')) {
401 const gameScreen = engine.element ().find ('[data-screen="game"]').get (0) as ComponentWithState | undefined;
402 gameScreen?.setState ({ open: true });
403 } else {
404 const mainScreen = engine.element ().find ('[data-screen="main"]').get (0) as ComponentWithState | undefined;
405 mainScreen?.setState ({ open: true });
406 }
407 }
408}
409
410// ============================================================================
411// Initial Screen

Callers

nothing calls this directly

Calls 5

hideScreensFunction · 0.85
debugMethod · 0.80
globalMethod · 0.80
getMethod · 0.65
elementMethod · 0.45

Tested by

no test coverage detected