jQuery callbacks.has() 方法

jQuery 教程 · 2019-03-29 17:16:46

实例

使用 callbacks.has() 检查列表中是否添加过一个回调

$(function () { //将被添加到列表的一个简单的函数 var foo = function( value1, value2 ) { alert( "Received: " + value1 + "," + value2 ); }; // a second function which will not be added to the list var bar = function( value1, value2 ) { alert( "foobar" ); } var callbacks = $.Callbacks(); // 添加函数到列表 callbacks.add( foo ); alert( callbacks.has( foo ) ); // true alert( callbacks.has( bar ) ); // false })

定义和用法

callbacks.has() 函数用于判断回调列表中是否添加过某回调函数。

语法

callbacks.has( callback )

参数 描述
callback Function类型 用来查找的回调函数

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

查看所有标签

Open Data Structures

Open Data Structures

Pat Morin / AU Press / 2013-6 / USD 29.66

Offered as an introduction to the field of data structures and algorithms, Open Data Structures covers the implementation and analysis of data structures for sequences (lists), queues, priority queues......一起来看看 《Open Data Structures》 这本书的介绍吧!

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

多种字符组合密码

RGB HSV 转换
RGB HSV 转换

RGB HSV 互转工具

HEX HSV 转换工具
HEX HSV 转换工具

HEX HSV 互换工具