refactor: latus.get

This commit is contained in:
cha0s 2021-01-21 19:28:42 -06:00
parent 967145c115
commit 951b7e4f90
2 changed files with 3 additions and 3 deletions

View File

@ -34,7 +34,7 @@ export default (latus) => class EntityList extends decorate(JsonResource) {
const {constructor: {s13nType}} = packet;
switch (s13nType) {
case 'create': {
const {fromResourceType: {Entity}} = resource(latus);
const {Entity} = latus.get('%resources.fromResourceType');
this.addEntity(await Entity.load(packet.data.spec));
break;
}
@ -99,7 +99,7 @@ export default (latus) => class EntityList extends decorate(JsonResource) {
async load(json = []) {
await super.load(json);
const {fromResourceType: {Entity}} = resource(latus);
const {Entity} = latus.get('%resources.fromResourceType');
const entityInstances = await Promise.all(json.map((entity) => Entity.load(entity)));
for (let i = 0; i < entityInstances.length; i++) {
this.addEntity(entityInstances[i]);

View File

@ -229,7 +229,7 @@ export default (latus) => class Spawner extends decorate(Trait) {
const childIndex = this.#children.length;
this.#children.push(null);
const list = this.destinationEntityList();
const {fromResourceType: {Entity}} = resource(latus);
const {Entity} = latus.get('%resources.fromResourceType');
const child = await Entity.load(json);
this.#children[childIndex] = child;
// Listen for destroy event.