回乡偶书二首【其一】(贺知章)

少小离家老大回,乡音无改鬓毛衰。

儿童相见不相识,笑问客从何处来。

">
立诚勿怠,格物致知
It's all about connecting the dots

Deferred objects and their promises in jQuery

Deferred objeccts and their promises allow us to react to the conpletion of long-running tasks with a convenient syntax.

Object creation

Object creation
Function Description
$.Deferred([setupFunction]) Returns a new deferred object.
$.when(deferreds) Returns a promise object to be resolved when the given deferred objecs are resolved.

Methods of deferred objects

Methods of deferred objects
Method Description
.resolve([args]) Sets the state of the object to resolved.
.resolveWith(context, [args]) Sets the state of the objec to resolved while making the keyword this refer to context within callbacks.
.rejectWith([args]) Sets the state of the object to rejected.
.rejectWith(context, [args]) Sets the state of the object to rejected while making the keyword this refer to context within callbacks.
.notify([args]) Executes any progress callbacks.
.notifyWith(context, [args]) Executes any progress callback while making the keyword this refer to context.
.promise([target]) Returns a promise object corresponding to this deferred object.

Methods of promise objects

Methods of promise objects
Method Description
.done(callback) Executes callback when the object is resolved.
.fail(callback) Executes callback when the object is rejected.
.always(callback) Executes callback when the object is resolved or rejected.
.then(doneCallbacks, failCallbacks) Executes doneCallbacks when the object is resolved, or failCallbacks when the object is rejected.
.progress(callback) Executes callback each time the object receives a progress notification.
.isRejected() Returns true if the object has been rejected.
.isResolved() Returns true if the object has been resolved.
.state() Returns ‘pending’, ‘resolved’, or ‘rejected’ depending on the current state.
.pipe([doneFilter], [failFilter]) Returns a new promise object which is resolved when the original promise is, optionally after filtering the object’s status through a function.
赞(0) 打赏
文章名称:《Deferred objects and their promises in jQuery》
文章链接:https://www.orzzone.com/deferred-objects-and-their-promises-in-jquery.html
商业联系:yakima.public@gmail.com

本站大部分文章为原创或编译而来,对于本站版权文章,未经许可不得用于商业目的,非商业性转载请以链接形式标注原文出处。
本站内容仅供个人学习交流,不做为任何投资、建议的参考依据,因此产生的问题需自行承担。

评论 抢沙发

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续给力提供更多优质内容!

支付宝扫一扫打赏

微信扫一扫打赏

登录

找回密码

注册