npm i -E @prelude/wait-group
import WaitGroup from '@prelude/wait-group'
const group = new WaitGroup(2)
const complete = group.wait()
group.done()
group.done()
await complete
add(delta), and done(delta) accept non-negative safe integers only. Invalid arguments throw without changing a healthy group.add() again.reject(error) also enters the terminal failed state. The first failure is preserved.wait() calls reject with the original failure, while future add() and done() calls throw it synchronously.This package is dedicated to the public domain under CC0 1.0.