refactor: use stream
This commit is contained in:
parent
9b5419376a
commit
0bbc838359
|
@ -71,12 +71,11 @@ export class Lootable extends decorate(Trait) {
|
|||
ttl: 0.25,
|
||||
},
|
||||
};
|
||||
const promise = this.entity.emitParticleJson(
|
||||
json
|
||||
).then((particle) => {
|
||||
this.entity.list.addEntity(particle);
|
||||
});
|
||||
promises.push(promise);
|
||||
const stream = this.entity.emitParticleJson(json);
|
||||
promises.push(new Promise((resolve) => {
|
||||
stream.onValue(particle => this.entity.list.addEntity(particle));
|
||||
stream.onEnd(() => { resolve(); });
|
||||
}));
|
||||
}
|
||||
return Promise.all(promises);
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user