|
|
@@ -8,6 +8,7 @@ class element {
|
|
|
#description;
|
|
|
#params;
|
|
|
#links;
|
|
|
+ #thumbnail;
|
|
|
|
|
|
constructor(id) {
|
|
|
if (typeof(id) !== "number") {
|
|
|
@@ -15,11 +16,12 @@ class element {
|
|
|
}
|
|
|
|
|
|
this.#id = id;
|
|
|
- this.#pictures = {};
|
|
|
- this.#params = {};
|
|
|
- this.#links = {};
|
|
|
+ this.#pictures = new Set();
|
|
|
+ this.#params = new Map();
|
|
|
+ this.#links = new Map();
|
|
|
this.#name = undefined;
|
|
|
this.#mesh = undefined;
|
|
|
+ this.#thumbnail = undefined;
|
|
|
}
|
|
|
|
|
|
get id() {
|
|
|
@@ -50,39 +52,27 @@ class element {
|
|
|
this.#mesh = content;
|
|
|
}
|
|
|
|
|
|
- get links() {
|
|
|
- const mesh = {};
|
|
|
- mesh[lang.element.mesh.link] = this.mesh;
|
|
|
-
|
|
|
- return Object.assign(this.#links, mesh);
|
|
|
+ set thumbnail(content) {
|
|
|
+ if (typeof(content) !== "string") {
|
|
|
+ throw "Thumbnail URL must be string.";
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- set links(content) {
|
|
|
- if (typeof(content) !== "object") {
|
|
|
- throw "Links must be an object.";
|
|
|
- }
|
|
|
-
|
|
|
- this.#links = Object.assign({}, content);
|
|
|
+
|
|
|
+ get thumbnail() {
|
|
|
+ return this.#thumbnail;
|
|
|
}
|
|
|
-
|
|
|
- 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 links() {
|
|
|
+ return this.#links;
|
|
|
}
|
|
|
|
|
|
- get title() {
|
|
|
-
|
|
|
+ get params() {
|
|
|
+ return this.#params;
|
|
|
}
|
|
|
+
|
|
|
+ get pictures() {
|
|
|
+ return this.#pictures;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
export { element };
|