refactor: entity.state getter
This commit is contained in:
parent
42c9221c49
commit
91dccd9329
|
@ -110,7 +110,7 @@ class Entity extends decorate(Resource) {
|
|||
types.forEach((type) => this.removeTrait(type));
|
||||
}
|
||||
|
||||
state() {
|
||||
get state() {
|
||||
return this.traits_PRIVATE.state();
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ class EntityListBase {
|
|||
}
|
||||
else {
|
||||
entity.acceptStateChange(change[uuid]);
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(localUuid, entity.state());
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(localUuid, entity.state);
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
@ -56,7 +56,7 @@ class EntityListBase {
|
|||
addEntity(entity) {
|
||||
const uuid = entity.instanceUuid;
|
||||
this.entities_PRIVATE[uuid] = entity;
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(uuid, entity.state());
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(uuid, entity.state);
|
||||
entity.addTrait('listed');
|
||||
entity.list = this;
|
||||
entity.once('destroyed', () => {
|
||||
|
@ -94,7 +94,7 @@ class EntityListBase {
|
|||
recomputeState() {
|
||||
for (const uuid in this.entities_PRIVATE) {
|
||||
const entity = this.entities_PRIVATE[uuid];
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(uuid, entity.state());
|
||||
this.state_PRIVATE = this.state_PRIVATE.set(uuid, entity.state);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user