| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788 |
- import { lang } from "./lang.js";
- class element {
- #id;
- #pictures;
- #mesh;
- #name;
- #description;
- #params;
- #links;
- constructor(id) {
- if (typeof(id) !== "number") {
- throw "ID must be number.";
- }
- this.#id = id;
- this.#pictures = {};
- this.#params = {};
- this.#links = {};
- this.#name = undefined;
- this.#mesh = undefined;
- }
- get id() {
- return this.#id;
- }
- set name(content) {
- if (typeof(content) !== "string") {
- throw "Name must be string.";
- }
- this.#name = content;
- }
- get name() {
- return this.#name;
- }
- get mesh() {
- return this.#mesh;
- }
- set mesh(content) {
- if (typeof(content) !== "string") {
- throw "Mesh URL must be string.";
- }
- this.#mesh = content;
- }
- get links() {
- const mesh = {};
- mesh[lang.element.mesh.link] = this.mesh;
- return Object.assign(this.#links, mesh);
- }
- set links(content) {
- if (typeof(content) !== "object") {
- throw "Links must be an object.";
- }
- this.#links = Object.assign({}, content);
- }
- addLink(name, url) {
- if (typeof(name) !== "string") {
- throw "Name must be string.";
- }
- if (typeof(url) !== "string") {
- throw "Url must be string.";
- }
- const new_link = {};
- new_link[name] = url;
- this.#links = Object.assign(new_link, this.#links);
- }
- get title() {
-
- }
- }
- export { element };
|