refactor: latus.get
This commit is contained in:
parent
967145c115
commit
951b7e4f90
|
@ -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]);
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue
Block a user