search

goog.async.DeferredList

Provided By
Extends
All Implemented Interfaces

Constructs an object that waits on the results of multiple asynchronous operations and marshals the results. It is itself a Deferred, and may have an execution sequence of callback functions added to it. Each DeferredList instance is single use and may be fired only once.

The default behavior of a DeferredList is to wait for a success or error result from every Deferred in its input list. Once every result is available, the DeferredList's execution sequence is fired with a list of [success, result] array pairs, where success is a boolean indicating whether result was the product of a callback or errback. The list's completion criteria and result list may be modified by setting one or more of the boolean options documented below.

Deferred instances passed into a DeferredList are independent, and may have additional callbacks and errbacks added to their execution sequences after they are passed as inputs to the list.

new DeferredList( list, opt_fireOnOneCallback, opt_fireOnOneErrback, opt_consumeErrors, opt_canceler, opt_defaultScope )

Parameters
listArray<goog.async.Deferred>

An array of deferred results to wait for.

opt_fireOnOneCallbackboolean=

Whether to stop waiting as soon as one input completes successfully. In this case, the DeferredList's callback chain will be called with a two element array, [index, result], where index identifies which input Deferred produced the successful result.

opt_fireOnOneErrbackboolean=

Whether to stop waiting as soon as one input reports an error. The failing result is passed to the DeferredList's errback sequence.

opt_consumeErrorsboolean=

When true, any errors fired by a Deferred in the input list will be captured and replaced with a succeeding null result. Any callbacks added to the Deferred after its use in the DeferredList will receive null instead of the error.

opt_canceler(Function|null)=

A function that will be called if the DeferredList is canceled. @see goog.async.Deferred#cancel

opt_defaultScope(Object|null)=

The default scope to invoke callbacks or errbacks in.

Instance Methods

Static Functions