Use this if you want run several asynchronous tasks concurrently and run a function when all the results come back. (E.g. if you want to make multiple web requests or database queries, then use them together).
var wg = ;wgadd;initResource1on"done"wgdone;;wgadd;initResource2on"done"wgdone;;wgadd;initResource3on"done"wgdone;;wgwaitconsole.log"All done!";
Increments the WaitGroup counter
Decrements the WaitGroup counter. When the counter becomes
0, the function
wait() will be called.
Registers a callback to be called when all tasks in the WaitGroup are done.
Run the tests with