class Deferred<T>

All implemented interfaces:
webdriver.promise.Thenable<T>

Represents a value that will be resolved at some point in the future. This class represents the protected "producer" half of a Promise - each Deferred has a promise property that may be returned to consumers for registering callbacks, reserving the ability to resolve the deferred to the producer.

If this Deferred is rejected and there are no listeners registered before the next turn of the event loop, the rejection will be passed to the webdriver.promise.ControlFlow as an unhandled failure.

new Deferred(opt_flow)

Parameters
opt_flow?webdriver.promise.ControlFlow=

The control flow this instance was created under. This should only be provided during unit tests.

Instance Methods

cancel(opt_reason)code »

Specified by: webdriver.promise.Thenable


fulfill(opt_value)code »

Resolves this deferred with the given value. It is safe to call this as a normal function (with no bound "this").

Parameters
opt_value?(T|IThenable<T>|{then: Function})=

The fulfilled value.


isPending()code »

Specified by: webdriver.promise.Thenable

Returns
boolean

reject(opt_reason)code »

Rejects this promise with the given reason. It is safe to call this as a normal function (with no bound "this").

Parameters
opt_reason*=

The rejection reason.


then(opt_cb, opt_eb)code »

deprecated

Specified by: webdriver.promise.Thenable

Deprecated: Use then from the promise property directly.

Parameters
opt_cb?function(T): (R|IThenable<R>)=
opt_eb?function(*): (R|IThenable<R>)=

thenCatch(opt_eb)code »

deprecated

Specified by: webdriver.promise.Thenable

Deprecated: Use thenCatch from the promise property directly.

Parameters
opt_ebfunction(*): (R|IThenable<R>)

thenFinally(opt_cb)code »

deprecated

Specified by: webdriver.promise.Thenable

Deprecated: Use thenFinally from the promise property directly.

Parameters
opt_cbfunction(): (R|IThenable<R>)

Instance Properties