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

查看所有标签

The Tangled Web

The Tangled Web

Michal Zalewski / No Starch Press / 2011-11-26 / USD 49.95

"Thorough and comprehensive coverage from one of the foremost experts in browser security." -Tavis Ormandy, Google Inc. Modern web applications are built on a tangle of technologies that have been de......一起来看看 《The Tangled Web》 这本书的介绍吧!

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

在线压缩/解压 JS 代码

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

html转js在线工具
html转js在线工具

html转js在线工具