element.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import { lang } from "./lang.js";
  2. class element {
  3. #id;
  4. #pictures;
  5. #mesh;
  6. #name;
  7. #description;
  8. #params;
  9. #links;
  10. #thumbnail;
  11. constructor(id) {
  12. if (typeof(id) !== "number") {
  13. throw "ID must be number.";
  14. }
  15. this.#id = id;
  16. this.#pictures = new Set();
  17. this.#params = new Map();
  18. this.#links = new Map();
  19. this.#name = undefined;
  20. this.#mesh = undefined;
  21. this.#thumbnail = undefined;
  22. }
  23. get id() {
  24. return this.#id;
  25. }
  26. set name(content) {
  27. if (typeof(content) !== "string") {
  28. throw "Name must be string.";
  29. }
  30. this.#name = content;
  31. }
  32. get name() {
  33. return this.#name;
  34. }
  35. get mesh() {
  36. return this.#mesh;
  37. }
  38. set mesh(content) {
  39. if (typeof(content) !== "string") {
  40. throw "Mesh URL must be string.";
  41. }
  42. this.#mesh = content;
  43. }
  44. set thumbnail(content) {
  45. if (typeof(content) !== "string") {
  46. throw "Thumbnail URL must be string.";
  47. }
  48. }
  49. get thumbnail() {
  50. return this.#thumbnail;
  51. }
  52. get links() {
  53. return this.#links;
  54. }
  55. get params() {
  56. return this.#params;
  57. }
  58. get pictures() {
  59. return this.#pictures;
  60. }
  61. }
  62. export { element };