How does JS determine that all requests in an asynchronous queue are completed?

the business scenario is like this


[getListA(),getListB(),getListC()]

getDetail()

getDetail can only be executed after getList is completed. How to judge that this queue is completed

idea 1: all requests are rewritten with async and await,

await getListA()

...
await getListC()

await getDetail()

but this will put all requests executed by Synchronize, while getListA (), getListB (), getListC () can be sent at the same time

< hr >

idea 2: add a request completion flag to each List, loop monitor whether all requests are completed, and finish loading detail

< hr >

is there a better way to implement

Mar.18,2022

await Promise.all([getListA(),getListB(),getListC()])

or

let p1 = getListA()
let p2 = getListB()

await p1;
await p2
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eac8bb-20e9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eac8bb-20e9.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?