Mergin better performance branch

This commit is contained in:
barsdeveloper
2022-09-04 14:33:22 +02:00
parent 47c15fbf8d
commit 715dee6a5a
97 changed files with 2725 additions and 2833 deletions

View File

@@ -1,12 +1,11 @@
// @ts-check
import ISerializable from "./ISerializable"
import Observable from "../Observable"
import TypeInitialization from "./TypeInitialization"
import Utility from "../Utility"
export default class IEntity extends ISerializable {
export default class IEntity extends Observable {
static attributes = {}
#showAsString = false
constructor(values) {
super()
@@ -53,7 +52,7 @@ export default class IEntity extends ISerializable {
}
if (defaultValue instanceof TypeInitialization) {
if (!defaultValue.showDefault) {
target[property] = undefined // Declare undefined to preserve the order or attributes
target[property] = undefined // Declare undefined to preserve the order of attributes
continue
}
defaultValue = defaultValue.value
@@ -68,7 +67,6 @@ export default class IEntity extends ISerializable {
target[property] = TypeInitialization.sanitize(defaultValue, defaultType)
}
}
// @ts-expect-error
const attributes = this.constructor.attributes
if (values.constructor !== Object && Object.getOwnPropertyNames(attributes).length == 1) {
// Where there is just one attribute, option can be the value of that attribute
@@ -78,4 +76,15 @@ export default class IEntity extends ISerializable {
}
defineAllAttributes(this, attributes, values)
}
isShownAsString() {
return this.#showAsString
}
/**
* @param {Boolean} v
*/
setShowAsString(v) {
this.#showAsString = v
}
}