// To import the "promises" module:
var promises = require("promises");
| Enum |
Description |
| Status |
The status of a Promise. Initially a Promise is Unfulfilled and may |
| change to Rejected or Resolved. |
|
| Once a promise is either Rejected or Resolved, it can not change its |
|
| status anymore. |
|
| Object |
Description |
| Rejection |
If a promise gets rejected, at least a message that indicates the error or |
| reason for the rejection must be provided. |
|
| PromiseState |
Both Promise<T> and Deferred<T> share these properties. |
| Promise |
A Promise<Value> supports basic composition and registration of handlers that are called when the |
| promise is fulfilled. |
|
| When multiple handlers are registered with done(), fail(), or always(), they are called in the |
|
| same order. |
|
| Deferred |
Deferred<Value> supports the explicit resolving and rejecting of the |
| promise and the registration of fulfillment handlers. |
|
| A Deferred<Value> should be only visible to the function that initially sets up |
|
| an asynchronous process. Callers of that function should only see the Promise<Value> that |
|
| is returned by promise(). |
|
| Generator |
Promise Generators and Iterators. |
| Iterator |
|
- defer() Deferred...
Types Parameters: Value
Module P: Generic Promises for TypeScript
Project, documentation, and license: https://github.com/pragmatrix/Promise
Returns a new "Deferred" value that may be resolved or rejected.
- resolve( v Value ) Promise...
Types Parameters: Value
Converts a value to a resolved promise.
- v - Value
- return - Promise of Value
- reject( err Rejection ) Promise...
Types Parameters: Value
Returns a rejected promise.
- unfold( unspool Function..., seed Seed ) Promise...
Types Parameters: Seed, Element
http://en.wikipedia.org/wiki/Anamorphism
Given a seed value, unfold calls the unspool function, waits for the returned promise to be resolved, and then
calls it again if a next seed value was returned.
All the values of all promise results are collected into the resulting promise which is resolved as soon
the last generated element value is resolved.
- unspool - Function(current Seed) { promise: Promise of Element, next: Seed }
- seed - Seed
- return - Promise of Array of Element
- when( ...promises Array of Promise... ) Promise...
Creates a promise that gets resolved when all the promises in the argument list get resolved.
As soon one of the arguments gets rejected, the resulting promise gets rejected.
If no promises were provided, the resulting promise is immediately resolved.
- ...promises - Array of Promise of Object
- return - Promise of Array of Object
- generator( g Function... ) Generator...
Types Parameters: E
- iterator( f Function... ) Iterator...
Types Parameters: E
- each( gen Generator..., f Function... ) Promise...
Types Parameters: E
Iterator functions.
- isUndefined( v Object ) Boolean
std
- v - Object
- return - Boolean