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
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》 这本书的介绍吧!