Notes/src/public/app/components/mobile_screen_switcher.ts

16 lines
575 B
TypeScript
Raw Normal View History

2022-12-01 13:07:23 +01:00
import Component from "./component.js";
import type { CommandListener, CommandListenerData } from "./app_context.js";
2020-03-01 15:19:16 +01:00
export type Screen = "detail" | "tree";
2025-01-09 18:07:02 +02:00
export default class MobileScreenSwitcherExecutor extends Component implements CommandListener<"setActiveScreen"> {
private activeScreen?: Screen;
2025-01-09 18:07:02 +02:00
setActiveScreenCommand({ screen }: CommandListenerData<"setActiveScreen">) {
2020-03-01 15:19:16 +01:00
if (screen !== this.activeScreen) {
this.activeScreen = screen;
2025-01-09 18:07:02 +02:00
this.triggerEvent("activeScreenChanged", { activeScreen: screen });
2020-03-01 15:19:16 +01:00
}
}
2022-12-01 13:07:23 +01:00
}