new DjsDeferred()
Initializes a new DjsDeferred object.
- Compability Note A - Ordering of callbacks through chained 'then' invocations
The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A implies that .then() returns a distinct object. For compatibility with http://api.jquery.com/category/deferred-object/ we return this same object. This affects ordering, as the jQuery version will fire callbacks in registration order regardless of whether they occur on the result or the original object. - Compability Note B - Fulfillment value
The Wiki entry at http://wiki.commonjs.org/wiki/Promises/A implies that the result of a success callback is the fulfillment value of the object and is received by other success callbacks that are chained. For compatibility with http://api.jquery.com/category/deferred-object/ we disregard this value instead.
- Source:
Methods
-
promise()
-
Returns a version of this object that has only the read-only methods available.
- Source:
Returns:
An object with only the promise object. -
reject()
-
Invokes error callbacks for this deferred object. All arguments are forwarded to error callbacks.
- Source:
-
resolve()
-
Invokes success callbacks for this deferred object. All arguments are forwarded to success callbacks.
- Source:
-
then(fulfilledHandler, errorHandler)
-
Adds success and error callbacks for this deferred object. See Compatibility Note A.
Parameters:
Name Type Argument Description fulfilledHandler
function <optional>
Success callback ( may be null) errorHandler
function <optional>
Error callback ( may be null) - Source: