mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-05-20 12:57:36 +08:00
Relaxed enum value
This commit is contained in:
37
js/entity/MirroredEntity.js
Normal file
37
js/entity/MirroredEntity.js
Normal file
@@ -0,0 +1,37 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user