jQuery callbacks.fireWith() 方法

jQuery 教程 · 2019-03-29 16:59:06

实例

访问给定的上下文"window"和数组参数调用列表中的所有回调

$(function () { //将被添加到列表的一个简单的函数 var log = function( value1, value2 ) { alert( "Received: " + value1 + "," + value2 ); }; var callbacks = $.Callbacks(); // 添加函数到列表 callbacks.add( log ); // 使用上下文"window"调用回调列表 // 和一个数组参数 callbacks.fireWith( window, ["foo","bar"]); // 输出: "Received: foo, bar" })

定义和用法

callbacks.fireWith() 函数给定上下文和参数来访问列表中的所有回调。

语法

callbacks.fireWith( [context ] [, args ] )

参数 描述
context 该回调列表中被触发的上下文的一个引用
args 回传给回调列表的一个参数或参数列表

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

查看所有标签

Discrete Mathematics and Its Applications

Discrete Mathematics and Its Applications

Kenneth H Rosen / McGraw-Hill Science/Engineering/Math / 2003-04-22 / USD 132.81

Discrete Mathematics and its Applications is a focused introduction to the primary themes in a discrete mathematics course, as introduced through extensive applications, expansive discussion, and deta......一起来看看 《Discrete Mathematics and Its Applications》 这本书的介绍吧!

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

在线压缩/解压 HTML 代码

JS 压缩/解压工具
JS 压缩/解压工具

在线压缩/解压 JS 代码

UNIX 时间戳转换
UNIX 时间戳转换

UNIX 时间戳转换