dojo/request.__Promise

Note: This is not a real constructor, but just a description of the type of object that should be passed as a parameter to some method(s), and/or the return value from some method(s). In other words, the type exists only for documentation purposes, and you cannot call new request.__Promise()

Usage

var foo = new request.__Promise();

dojo/promise/Promise

<

The public interface to a deferred. All promises in Dojo are instances of this class.

>

The public interface to a deferred. All promises in Dojo are instances of this class.

>

Properties

response

Defined by: dojo/request

A promise resolving to an object representing the response from the server.

Methods

always(callbackOrErrback)

Defined by dojo/promise/Promise

Add a callback to be invoked when the promise is resolved or rejected.

Parameter Type Description
callbackOrErrback Function
Optional

A function that is used both as a callback and errback.

Returns: dojo/promise/Promise | undefined

Returns a new promise for the result of the callback/errback.

cancel(reason,strict)

Defined by dojo/promise/Promise

Inform the deferred it may cancel its asynchronous operation.

Inform the deferred it may cancel its asynchronous operation. The deferred's (optional) canceler is invoked and the deferred will be left in a rejected state. Can affect other promises that originate with the same deferred.

Parameter Type Description
reason any

A message that may be sent to the deferred's canceler, explaining why it's being canceled.

strict Boolean
Optional

If strict, will throw an error if the deferred has already been fulfilled and consequently cannot be canceled.

Returns: any

Returns the rejection reason if the deferred was canceled normally.

isCanceled()

Defined by dojo/promise/Promise

Checks whether the promise has been canceled.

Returns: Boolean

isFulfilled()

Defined by dojo/promise/Promise

Checks whether the promise has been resolved or rejected.

Returns: Boolean

isRejected()

Defined by dojo/promise/Promise

Checks whether the promise has been rejected.

Returns: Boolean

isResolved()

Defined by dojo/promise/Promise

Checks whether the promise has been resolved.

Returns: Boolean

otherwise(errback)

Defined by dojo/promise/Promise

Add new errbacks to the promise.

Parameter Type Description
errback Function
Optional

Callback to be invoked when the promise is rejected.

Returns: dojo/promise/Promise | undefined

Returns a new promise for the result of the errback.

then(callback,errback,progback)

Defined by dojo/promise/Promise

Add new callbacks to the promise.

Add new callbacks to the deferred. Callbacks can be added before or after the deferred is fulfilled.

Parameter Type Description
callback Function
Optional

Callback to be invoked when the promise is resolved. Receives the resolution value.

errback Function
Optional

Callback to be invoked when the promise is rejected. Receives the rejection error.

progback Function
Optional

Callback to be invoked when the promise emits a progress update. Receives the progress update.

Returns: dojo/promise/Promise

Returns a new promise for the result of the callback(s). This can be used for chaining many asynchronous operations.

toString()

Defined by dojo/promise/Promise

Returns: string

Returns [object Promise].

trace()

Defined by dojo/promise/Promise

Returns: function

traceRejected()

Defined by dojo/promise/Promise

Returns: function

© 2005–2017 JS Foundation
Licensed under the AFL 2.1 and BSD 3-Clause licenses.
http://dojotoolkit.org/api/1.10/dojo/request.__Promise.html