iwhen, Immediate Promises
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.
APIs that may be used with iwhen
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.
Incompatibilities to when.js
- deprecated parameters were removed.
iwhen.all()is a variadic function and so does not expect arrays. To wait for multiple promises, use
iwhen.all(a, b)instead of
Licensed under the MIT License.