Saturday 25 August 2018

'await' multiple async functions?

I have a set of async functions that I want to run and I do not want the program to execute any further without all of them returning their callback function. The problem is that if I await every single one of them linearly it will take a long time to complete.Is there a way to run a set of async functions and await all their callbacks simultaneously? like wrapping them in a larger function and then awaiting that single function?I just thought of this...could I have a boolean array filled 'false' and then in each callback update one index to true. then after my await functions have: while(boolArr.indexOf(false) !== -1){} inorder to hold the program in suspension until all have calledback?

Submitted August 25, 2018 at 03:36PM by CSS_Programmer

No comments:

Post a Comment