mode-selector.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. import { full_screen_selector } from "./full-screen-selector.js";
  2. import { selector } from "./selector.js";
  3. import { selector_item } from "./selector-item.js";
  4. import { types } from "assets/types.js";
  5. class mode_selector extends full_screen_selector {
  6. #on_shelf;
  7. #on_space;
  8. constructor(app) {
  9. super(app, "mode-selector");
  10. this.#on_shelf = () => {};
  11. this.#on_space = () => {};
  12. this.add(new selector_item(
  13. "Shelf",
  14. "./theme/icons/shelf.svg",
  15. () => { this.#on_shelf(app); }
  16. ));
  17. this.add(new selector_item(
  18. "Space",
  19. "./theme/icons/space.svg",
  20. () => { this.#on_space(app); }
  21. ));
  22. }
  23. set on_space(target) {
  24. types.check_callback(target);
  25. this.#on_space = target;
  26. }
  27. get on_space() {
  28. return this.#on_space;
  29. }
  30. set on_shelf(target) {
  31. types.check_callback(target);
  32. this.#on_shelf = target;
  33. }
  34. get on_shelf() {
  35. return this.#on_shelf;
  36. }
  37. }
  38. export { mode_selector };