Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

jQuery deferred.notifyWith() method

jQuery deferred.notifyWith() method

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods


Definition and Usage

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

**Note:** 1. Typically, only the creator of the Deferred object can call this method.
2. You can call deferred.promise() to return a restricted Promise object, preventing other code from changing the state of the deferred object or reporting its state.
3. When deferred.notifyWith is called, any progressCallbacks can be added via deferred.then or deferred.progress. Callbacks are executed in the order in which 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 additions of progressCallbacks) are ignored.


Syntax

deferred.notifyWith( context [, args ] )

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

jQuery Miscellaneous MethodsjQuery Miscellaneous Methods