mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-15 17:54:52 +08:00
38 lines
756 B
JavaScript
38 lines
756 B
JavaScript
import IEntity from "./IEntity.js"
|
|
|
|
/** @typedef {import("./IEntity.js").EntityConstructor} EntityConstructor */
|
|
|
|
export default class MirroredEntity extends IEntity {
|
|
|
|
static attributes = {
|
|
...super.attributes,
|
|
type: {
|
|
ignored: true,
|
|
},
|
|
key: {
|
|
ignored: true,
|
|
},
|
|
object: {
|
|
ignored: true,
|
|
},
|
|
}
|
|
|
|
constructor(values = {}) {
|
|
super({})
|
|
/** @type {EntityConstructor} */ this.type
|
|
/** @type {String} */ this.key
|
|
/** @type {IEntity} */ this.object
|
|
}
|
|
|
|
get() {
|
|
return this.object?.[this.key]
|
|
}
|
|
|
|
|
|
set(value) {
|
|
if (this.object[this.key]) {
|
|
this.object[this.key] = value
|
|
}
|
|
}
|
|
}
|