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 {@code 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 {@link webdriver.promise.ControlFlow} as an unhandled failure.
If this Deferred is cancelled, the cancellation reason will be forward to the Deferred's canceller function (if provided). The canceller may return a truth-y value to override the reason provided for rejection.
Function to call when cancelling the computation of this instance's value.
The control flow this instance was created under. This should only be provided during unit tests.
The consumer promise for this instance. Provides protected access to the callback registering functions.
Registers a function to be invoked when this promise is either rejected or resolved. This function is provided for backwards compatibility with the Dojo Deferred API.
The function to call when this promise is either resolved or rejected. The function should expect a single argument: the resolved value or rejection error.
The object which |this| should refer to when the function is invoked.
A new promise which will be resolved with the result of the invoked callback.
Registers a function to be invoked when this promise is successfully resolved. This function is provided for backwards compatibility with the Dojo Deferred API.
The function to call if this promise is successfully resolved. The function should expect a single argument: the promise's resolved value.
The object which |this| should refer to when the function is invoked.
A new promise which will be resolved with the result of the invoked callback.
An alias for {@code webdriver.promise.Promise.prototype.then} that permits the scope of the invoked function to be specified. This function is provided for backwards compatibility with the Dojo Deferred API.
The function to call if this promise is successfully resolved. The function should expect a single argument: the promise's resolved value.
The function to call if this promise is rejected. The function should expect a single argument: the rejection reason.
The object which |this| should refer to when the function is invoked.
A new promise which will be resolved with the result of the invoked callback.
Registers a function to be invoked when this promise is rejected. This function is provided for backwards compatibility with the Dojo Deferred API.
The function to call if this promise is rejected. The function should expect a single argument: the rejection reason.
The object which |this| should refer to when the function is invoked.
A new promise which will be resolved with the result of the invoked callback.
Cancels the computation of this promise's value and flags the promise as a rejected value.
The reason for cancelling this promise.
Resolves this promise with the given value. If the value is itself a promise and not a reference to this deferred, this instance will wait for it before resolving.
The resolved value.
boolean
Whether this promise's value is still being computed.
Rejects this promise. If the error is itself a promise, this instance will be chained to it and be rejected with the error's resolved value.
The rejection reason, typically either a {@code Error} or a {@code string}.
Removes all of the listeners previously registered on this deferred.
Registers listeners for when this instance is resolved. This function most overridden by subtypes.
The function to call if this promise is successfully resolved. The function should expect a single argument: the promise's resolved value.
The function to call if this promise is rejected. The function should expect a single argument: the rejection reason.
A new promise which will be resolved with the result of the invoked callback.