-
Notifications
You must be signed in to change notification settings - Fork 1
Home
This project hosts practical algorithms to arrange asynchronous operations on node.js and browsers, and two specialized implementations of promises, if you need some advanced functionality.
This project provides a complete algebra over promises, and helpful utilities. Bundled deferred objects implement fast easy-to-debug promises with an extended API and functionality, including cancellable asynchronous operations, and progress signals. They are intentionally relax some Promise/A+ tenets to reduce code, and improve performance, e.g., by avoiding time-outs, which is important for client-side applications. Full interoperability with built-in ES6's Promise is provided out of box.
All algorithms (and specialized promises) can inter-operate with other implementations of promises. Everything works well with "foreign" promises as long as they are then()
-able (an object or function that defines a then
method).
To get more information on underlying concepts:
- Promises, deferreds, asynchronous operations.
- Differences between Promise, Deferred, and FastDeferred.
Included algorithms (work across all type of promises):
-
Compositions: all(), par(), any(), one(), race().
- The main entry point provides all compositions instrumented for the standard
Promise
.
- The main entry point provides all compositions instrumented for the standard
- Generic sequential execution of asynchronous operations: seq().
- Module seq provides
seq()
instrumented for the standardPromise
.
- Module seq provides
- Generic asynchronous loop: whilst().
- The venerable when() to adapt any value to generic
then()
-able promises. - Module timeout to resolve or reject promises after a timeout.
Included implementations of deferreds (can be used instead or alongside with the standard Promise
):
- Module Deferred.
- Module Deferred-ext, which adds compositions instrumented for
Deferred
.
- Module Deferred-ext, which adds compositions instrumented for
- Module FastDeferred.
- Module FastDeferred-ext, which adds compositions instrumented for
FastDeferred
.
- Module FastDeferred-ext, which adds compositions instrumented for
- Differences between them and standard promises are described here.