applet.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. import { dom_manager } from "./functions.js";
  2. class applet {
  3. #show;
  4. #hide;
  5. #current;
  6. #animation;
  7. #target;
  8. #change() {
  9. }
  10. #visible(animate = true) {
  11. if (animate) {
  12. this.#animation(true);
  13. }
  14. }
  15. #unvisible(animate = true) {
  16. if (animate) {
  17. this.#animation(this.false);
  18. }
  19. }
  20. #activate() {
  21. if (this.#hide === undefined) {
  22. this.#show.addEventListener("click", () => this.#change());
  23. } else {
  24. this.#show.addEventListener("click", () => this.#visible());
  25. this.#hide.addEventListener("click", () => this.#unvisible());
  26. }
  27. if (this.#current) {
  28. this.#visible(false);
  29. } else {
  30. this.#unvisible(false);
  31. }
  32. }
  33. constructor(target, change, current, animation) {
  34. this.#current = current;
  35. this.#show = change;
  36. this.#animation = animation;
  37. this.#target = target;
  38. this.#hide = undefined;
  39. this.#activate();
  40. }
  41. constructor(target, show, hide, current, animation) {
  42. this.#current = current;
  43. this.#show = show;
  44. this.#hide = hide;
  45. this.#animation = animation;
  46. this.#target = target;
  47. this.#activate();
  48. }
  49. }
  50. export { applet };