jQuery deferred.promise () method
Examples
Set the delay time is a random two timers are used to resolve (resolve) and rejection (reject) Lingering objects
try it"
Definition and Usage
deferred.promise () function returns the Deferred (delay) the Promise object.
Note: 1. The method allows an asynchronous function that prevents progress to interfere in its internal requests (progress) or state (status) of the other code.
2. Only a group comprising deferred object, comprising: done (), then (), fail (), isResolved (), isRejected (), always (), these methods can only observe a deferred state, and can not be changed deferred internal state of the object.
3. deferred.promise () can accept a target parameter, then the incoming target will be given Promise method, and returned as the result, rather than creating a new object.
grammar
参数 | 描述 |
---|---|
target | Object类型 绑定 promise 方法的对象。 |
More examples
Use target parameters
Use the target parameter, promote existing objects Promise