async await Promise.all
async getaaa()
async getbbb()
async getccc()
=======new way=======
async refreshall(){
await Promise.all( xxxxxx.map(async (value, index) =>{
aaa = await getaaa()
}))
await Promise.all( xxxxxx.map(async (value, index) =>{
bbb = await getbbb()
}))
await Promise.all( xxxxxx.map(async (value, index) =>{
ccc = await getccc()
}))
}
=======old way=======
async refreshall(){
await Promise.all( xxxxxx.map(async (value, index) =>{
aaa = await getaaa()
bbb = await getbbb()
ccc = await getccc()
}))
}
1. map usually return something, here just throw
2. if use foreach(), get error. Like foreach is not function, can’t async await.
old way aaa order is good, but bbb ccc order is bad.
new way all aaa bbb ccc order is ok.