Futures, Promises and Deferreds. Closure-based implumentation of Promises/A+ spec.
npm install fate[![Promises/A+ 1.0 compliant][A+logo]][A+]
Fate is a closure based implementation of [Promises/A+][A+]
[A+]: http://promises-aplus.github.com/promises-spec
[A+logo]: http://promises-aplus.github.com/promises-spec/assets/logo-small.png
promise is an object with a then(onFulfilled, onRejected) closure, making a promise a thenable object.A future is a thenable with bound fulfill(value) and reject(reason) closures. In fate, a future is also a valid node style function(err,arg) callback.
fate.deferred() returns an unresolved (pending) future.
fate.fulfilled(value) returns a fulfilled promise.
fate.rejected(reason) returns a rejected promise.
inverted(aFuture) returns a promise that transposes onFulfilled and onRejected.
delay(ms, bFulfill=false) returns a deferred() that will be answered after ms timeout.
timeout(target, ms) returns a delay(ms) that will additionally be answered upon target being answered.
each(anArray) is a compound deferred() answered afteranArray are either rejected or fulfilled.Fulfilled if all promise are fulfilled from anArray.
Rejected if any promises is rejected from anArray.
all(anArray) is a compound deferred() answered afterFulfilled if any promise is fulfilled from anArray.
Rejected if all promises are rejected from anArray.
first(anArray) is a compound deferred() answered afterFulfilled if any promise is fulfilled from anArray.
Rejected if all promises are rejected from anArray.
any(anArray) is a compound deferred() answered afterFulfilled if any promise is fulfilled from anArray.
Rejected if all promises are rejected from anArray.