Static equivalent to `promise.done`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
onFulfilled
Function
Callback that will be invoked with a provided value after the promise has been fulfilled
onRejected
Function
Callback that will be invoked with a provided reason after the promise has been rejected
onProgress
Function
Callback that will be invoked with a provided value after the promise has been notified
ctx
Object
Context of the callbacks execution
isPromise(value):Boolean
description
Checks whether the given `value` is a promise-like object
parameters
value
*
cast(value):vow:Promise
description
Coerces the given `value` to a promise, or returns the `value` if it's already a promise.
parameters
value
*
valueOf(value):Any
description
Static equivalent to `promise.valueOf`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
isFulfilled(value):Boolean
description
Static equivalent to `promise.isFulfilled`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
isRejected(value):Boolean
description
Static equivalent to `promise.isRejected`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
isResolved(value):Boolean
description
Static equivalent to `promise.isResolved`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
resolve(value):vow:Promise
description
Returns a promise that has already been resolved with the given `value`.
If `value` is a promise, the returned promise will have `value`'s state.
parameters
value
*
fulfill(value):vow:Promise
description
Returns a promise that has already been fulfilled with the given `value`.
If `value` is a promise, the returned promise will be fulfilled with the fulfill/rejection value of `value`.
parameters
value
*
reject(reason):vow:Promise
description
Returns a promise that has already been rejected with the given `reason`.
If `reason` is a promise, the returned promise will be rejected with the fulfill/rejection value of `reason`.
parameters
reason
*
invoke(fn, [args]):vow:Promise
description
Invokes the given function `fn` with arguments `args`
parameters
fn
Function
args
...*
all(iterable):vow:Promise
description
Returns a promise, that will be fulfilled only after all the items in `iterable` are fulfilled.
If any of the `iterable` items gets rejected, the promise will be rejected.
parameters
iterable
Array, Object
allResolved(iterable):vow:Promise
description
Returns a promise, that will be fulfilled only after all the items in `iterable` are resolved.
parameters
iterable
Array, Object
any(iterable):vow:Promise
description
Returns a promise, that will be fulfilled if any of the items in `iterable` is fulfilled.
If all of the `iterable` items get rejected, the promise will be rejected (with the reason of the first rejected item).
parameters
iterable
Array
anyResolved(iterable):vow:Promise
description
Returns a promise, that will be fulfilled only when any of the items in `iterable` is fulfilled.
If any of the `iterable` items gets rejected, the promise will be rejected.
parameters
iterable
Array
delay(value, delay):vow:Promise
description
Static equivalent to `promise.delay`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
delay
Number
timeout(value, timeout):vow:Promise
description
Static equivalent to `promise.timeout`.
If `value` is not a promise, then `value` is treated as a fulfilled promise.
parameters
value
*
timeout
Number
Class Deferred
Instance methods:
promise():vow:Promise
description
Returns the corresponding promise.
resolve(value)
description
Resolves the corresponding promise with the given `value`.
parameters
value
*
reject(reason)
description
Rejects the corresponding promise with the given `reason`.
parameters
reason
*
notify(value)
description
Notifies the corresponding promise with the given `value`.
parameters
value
*
Class Promise
Instance methods:
valueOf():Any
description
Returns the value of the fulfilled promise or the reason in case of rejection.
Like `then`, but terminates a chain of promises.
If the promise has been rejected, this method throws it's "reason" as an exception in a future turn of the event loop.
parameters
onFulfilled
Function
Callback that will be invoked with a provided value after the promise has been fulfilled
onRejected
Function
Callback that will be invoked with a provided reason after the promise has been rejected
onProgress
Function
Callback that will be invoked with a provided value after the promise has been notified
ctx
Object
Context of the callbacks execution
delay(delay):vow:Promise
description
Returns a new promise that will be fulfilled in `delay` milliseconds if the promise is fulfilled,
or immediately rejected if the promise is rejected.
parameters
delay
Number
timeout(timeout):vow:Promise
description
Returns a new promise that will be rejected in `timeout` milliseconds
if the promise is not resolved beforehand.
parameters
timeout
Number
Static methods:
cast(value):vow:Promise
description
Coerces the given `value` to a promise, or returns the `value` if it's already a promise.
parameters
value
*
all(iterable):vow:Promise
description
Returns a promise, that will be fulfilled only after all the items in `iterable` are fulfilled.
If any of the `iterable` items gets rejected, then the returned promise will be rejected.
parameters
iterable
Array, Object
race(iterable):vow:Promise
description
Returns a promise, that will be fulfilled only when any of the items in `iterable` are fulfilled.
If any of the `iterable` items gets rejected, then the returned promise will be rejected.
parameters
iterable
Array
resolve(value):vow:Promise
description
Returns a promise that has already been resolved with the given `value`.
If `value` is a promise, the returned promise will have `value`'s state.
parameters
value
*
reject(reason):vow:Promise
description
Returns a promise that has already been rejected with the given `reason`.
parameters
reason
*
Constructor
parameters
resolver
Function
See https://github.com/domenic/promises-unwrapping/blob/master/README.md#the-promise-constructor for details.