jQuery deferred.notifyWith() 方法

jQuery 教程 · 2019-03-29 20:58:41

定义和用法

deferred.notify() 函数用于给定上下文和参数调用正在延迟对象上进行的回调函数( progressCallbacks )。

注意:1. 通常,只有延迟对象(Deferred)的创建者才能调用此方法。
2. 你可以通过调用 deferred.promise() 返回一个受限的 Promise 对象,来阻止其它代码改变延迟对象的状态或报告它的状态。
3. 当 deferred.notifyWith 被调用时, 任何 progressCallbacks 可以通过访问 deferred.then 或者 deferred.progress 来添加。回调 依照他们添加时的顺序执行。通过 .notifyWith() 传递参数给每个回调函数,当迟延对象已经被 resolved 或被 rejected 之后,再调用任何 .notifyWith() (或者添加 progressCallbacks) 都会被忽略。

语法

deferred.notifyWith( context [, args ] )

参数 描述
context Object类型 作为this对象传递给进行中的回调
args Object类型 可选参数,传递给进行中的回调

点击查看所有 jQuery 教程 文章: https://www.codercto.com/courses/l/35.html

查看所有标签

Algorithms to Live By

Algorithms to Live By

Brian Christian、Tom Griffiths / Henry Holt and Co. / 2016-4-19 / USD 30.00

A fascinating exploration of how insights from computer algorithms can be applied to our everyday lives, helping to solve common decision-making problems and illuminate the workings of the human mind ......一起来看看 《Algorithms to Live By》 这本书的介绍吧!

HTML 压缩/解压工具
HTML 压缩/解压工具

在线压缩/解压 HTML 代码

图片转BASE64编码
图片转BASE64编码

在线图片转Base64编码工具

随机密码生成器
随机密码生成器

多种字符组合密码