not sure how this would work API-wise, but the idea is to return a promise somewhere that resolves then there is no longer any promises in the queue.
const fn = throat(3, myOtherFunction)
fn(1)
fn(2)
fn(3)
fn(4)
fn.flush().then(doSomethingElse())
it should resolve immediately if there are no more functions in the queue. flush should throw if any of the promises in the queue failed.
not sure how this would work API-wise, but the idea is to return a promise somewhere that resolves then there is no longer any promises in the queue.
it should resolve immediately if there are no more functions in the queue. flush should throw if any of the promises in the queue failed.