then
and registering
onFulfilled
and onRejected
callbacks. Once the Promise
resolves, the relevant callbacks are invoked with the fulfillment value or
rejection reason as argument. Callbacks are always invoked in the order they
were registered, even when additional then
calls are made from inside
another callback. A callback is always run asynchronously sometime after the
scope containing the registering then
invocation has returned.
If a Promise is resolved with another Promise, the first Promise will block
until the second is resolved, and then assumes the same result as the second
Promise. This allows Promises to depend on the results of other Promises,
linking together multiple asynchronous operations.
This implementation is compatible with the Promises/A+ specification and
passes that specification's conformance test suite. A Closure Promise may be
resolved with a Promise instance (or sufficiently compatible Promise-like
object) created by other Promise implementations. From the specification,
Promise-like objects are known as "Thenables".
![]()
Marks this rejected Promise as unhandled. If no
onRejected callback
is called for this Promise before the UNHANDLED_REJECTION_DELAY
expires, the reason will be passed to the unhandled rejection handler. The
handler typically rethrows the rejection reason so that it becomes visible in
the developer console.
Arguments:
|
code » | |||
No description.
Arguments:
Returns: !goog.Promise.<!Array.<TYPE>>
A Promise that receives a list of
every fulfilled value once every input Promise (or Promise-like) is
successfully fulfilled, or is rejected by the first rejection result.
|
code » | |||
No description.
Arguments:
Returns: !goog.Promise.<TYPE>
A Promise that receives the value of the first
input to be fulfilled, or is rejected with a list of every rejection
reason if all inputs are rejected.
|
code » | |||
![]()
A method that is invoked with the rejection reasons for Promises that are
rejected but have no
onRejected callbacks registered yet.
|
code » | |||
![]()
No description.
|
code » | |||
![]()
No description.
|
code » | |||
![]()
No description.
|
code » | |||
![]()
No description.
|
code » | |||
No description.
Arguments:
Returns: !goog.Promise.<TYPE>
A Promise that receives the result of the
first Promise (or Promise-like) input to complete.
|
code » | |||
No description.
Arguments:
Returns: !goog.Promise
A new Promise that is immediately rejected with the
given reason.
|
code » | |||
![]()
No description.
|
code » | |||
No description.
Arguments:
|
code » | |||
![]()
No description.
|
code » | |||
![]()
Sets a handler that will be called with reasons from unhandled rejected
Promises. If the rejected Promise (or one of its descendants) has an
onRejected callback registered, the rejection will be considered
handled, and the rejection handler will not be called.
By default, unhandled rejections are rethrown so that the error may be
captured by the developer console or a window.onerror handler.
Arguments:
|
code » | |||
No description.
Returns: !goog.promise.Resolver.<TYPE>
Resolver wrapping the promise and its
resolve / reject functions. Resolving or rejecting the resolver
resolves or rejects the promise.
|
code » |