iwhen, Immediate Promises for TypeScript based on when.js
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
Makefile
README.md
idelay.js
idelay.ts
iunfold.js
iunfold.ts
iwhen.js
iwhen.nuspec
iwhen.ts

README.md

iwhen, Immediate Promises

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.

APIs that may be used with iwhen

IndexedDB

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 iwhen.all([a,b]).

License

Licensed under the MIT License.