Notes/apps/client/src/components/mobile_screen_switcher.ts
2025-04-22 22:12:56 +03:00

16 lines
575 B
TypeScript

import Component from "./component.js";
import type { CommandListener, CommandListenerData } from "./app_context.js";
export type Screen = "detail" | "tree";
export default class MobileScreenSwitcherExecutor extends Component implements CommandListener<"setActiveScreen"> {
private activeScreen?: Screen;
setActiveScreenCommand({ screen }: CommandListenerData<"setActiveScreen">) {
if (screen !== this.activeScreen) {
this.activeScreen = screen;
this.triggerEvent("activeScreenChanged", { activeScreen: screen });
}
}
}