This is an unfinished port of when.js to typescript that is specifically built to avoid delaying callbacks.
In this implementation, every callback passed to the library gets either called immediately or directly from within the context of the asynchronous function that fulfills the promise.
This change may have consequences in several areas, like making bugs harder to reproduce, or consuming a lot of stack space when the fulfillment runs synchronously.
But when used carefully, this library may be used for asynchronous APIs that are incompatible with current promise implementations.
In IndexedDB, a transaction lives as long as new requests are initiated in response to success callbacks from previous requests. If a promise library would delay the callback, the transaction may commit too early and before all the requests went through.
- deprecated parameters were removed.
iwhen.all()is a variadic function and so does not expect arrays. To wait for multiple promises, useiwhen.all(a, b)instead ofiwhen.all([a,b]).
Licensed under the MIT License.