Latest web development tutorials

jQuery deferred.resolveWith () method

jQuery Misc Methods jQuery Misc Methods


Definition and Usage

deferred.resolveWith () function is used to solve Deferred (delay) object and call any doneCallbacks callback function according to the given context and args parameters.


Note: 1. The delay is usually only object creator can call the method. You can call deferred.promise (), returns a limited Promise objects to prevent other code changes delayed state of the object or report its status.
2. When the delay object is resolved, any or deferred.done by deferred.then added doneCallbacks, will be called. The callback function in the order they are added to the execution. Passed to deferred.resolve () of the args parameter will be passed to each callback function. When the object enters resolved state delay any doneCallbacks is added, it will be executed immediately, and bring to pass .resolve () parameters.


grammar

deferred.resolveWith( context [, args ] )

参数 描述
context Object类型 作为 this对象传递给 doneCallbacks 回调函数
args Array类型 传递一个可选的参数数组给 oneCallbacks 回调函数


jQuery Misc Methods jQuery Misc Methods