use Promise.all for concurrency

This commit is contained in:
zhangenming
2021-09-05 16:27:15 +08:00
committed by 神戸小鳥
parent d86f2330d5
commit 1cf073bc51

View File

@@ -15,10 +15,11 @@ class Life {
#triggerTalents; #triggerTalents;
async initial() { async initial() {
const age = await json('age'); const [age, talents, events] = await Promise.all([
const talents = await json('talents'); json('age'),
const events = await json('events'); json('talents'),
json('events'),
])
this.#property.initial({age}); this.#property.initial({age});
this.#talent.initial({talents}); this.#talent.initial({talents});
this.#event.initial({events}); this.#event.initial({events});