mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-03 23:55:04 +08:00
* WIP * Fix type 1 * Missing types info * Some fixes * Several types refactoring and fixes * WIP * Fix grammar
37 lines
710 B
JavaScript
37 lines
710 B
JavaScript
export default class MirroredEntity {
|
|
|
|
static attributes = {
|
|
type: {
|
|
ignored: true,
|
|
},
|
|
key: {
|
|
ignored: true,
|
|
},
|
|
getter: {
|
|
ignored: true,
|
|
},
|
|
}
|
|
|
|
/**
|
|
* @param {EntityConstructor} type
|
|
* @param {String} key
|
|
*/
|
|
constructor(type, key, getter = () => null) {
|
|
this.type = type
|
|
this.key = key
|
|
this.getter = getter
|
|
}
|
|
|
|
get() {
|
|
return this.getter()
|
|
}
|
|
|
|
getTargetType() {
|
|
const result = this.type.attributes[this.key].type
|
|
if (result instanceof MirroredEntity) {
|
|
return result.getTargetType()
|
|
}
|
|
return result
|
|
}
|
|
}
|