element.js 1.6 KB

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