jQuery deferred.notifyWith()Method

jQuery 杂项方法jQuery Miscellaneous Methods


Definition and Usage

The deferred.notify() function is used to call the progress callbacks (progressCallbacks) on the deferred object with the given context and arguments.

Note:1. Usually, only the creator of the deferred object (Deferred) can call this method.
2. You can prevent other code from changing the state of the deferred object or reporting its state by calling deferred.promise() to return a restricted Promise object.
3. When deferred.notifyWith is called, any progressCallbacks can be added by accessing deferred.then or deferred.progress. The callbacks are executed in the order they were added. Arguments are passed to each callback via .notifyWith(). After the deferred object has been resolved or rejected, any further calls to .notifyWith() (or adding progressCallbacks) will be ignored.


Syntax

deferred.notifyWith( context [, args ] )

Parameters Description
context Object type Passed to the progress callbacks as the this object
args Object type Optional arguments passed to the progress callbacks


jQuery 杂项方法jQuery Miscellaneous Methods

Other Extensions