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. ...

2018-05-24 · 1 min · 111 words · Me