element.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. import { type_manager } from "./functions.js";
  2. class element {
  3. #name;
  4. #description;
  5. #pictures;
  6. #meshes;
  7. #solids;
  8. #order;
  9. constructor(
  10. name,
  11. description,
  12. pictures,
  13. meshes,
  14. solids,
  15. order
  16. ) {
  17. if (!type_manager.is_string(name)) {
  18. throw "Name of the element must be string.";
  19. }
  20. if (!type_manager.is_string(description)) {
  21. throw "Description of the element must be string.";
  22. }
  23. if (!type_manager.is_array(pictures)) {
  24. throw "Pictures must be array of files.";
  25. }
  26. if (!type_manager.is_array(meshes)) {
  27. throw "Meshes must be array of files.";
  28. }
  29. if (!type_manager.is_array(solids)) {
  30. throw "Solids must be array of files.";
  31. }
  32. if (!type_manager.is_array(order)) {
  33. throw "Order must be array of order.";
  34. }
  35. this.#name = name;
  36. this.#description = description;
  37. this.#pictures = pictures;
  38. this.#meshes = meshes;
  39. this.#solids = solids;
  40. this.#order = order;
  41. }
  42. get name() {
  43. return this.#name;
  44. }
  45. get description() {
  46. return this.#description;
  47. }
  48. get order() {
  49. return [...this.#order];
  50. }
  51. get pictures() {
  52. return [...this.#pictures];
  53. }
  54. get solids() {
  55. return [...this.#solids];
  56. }
  57. get meshes() {
  58. return [...this.#meshes];
  59. }
  60. }
  61. export { element };