返回值:Boolean callbacks.has(callback)
概述
確定是否提供的回撥列表
參數
callback V1.7
用來搜索的回撥。
示例
描述:
用 callbacks.has() 檢查是否回撥列表中包含一個特定的回撥:
jQuery 程式碼:
// a sample logging function to be added to a callbacks list
var foo = function( value1, value2 ){
console.log( 'Received:' + value1 + ',' + value2 );
}
// a second function which will not be added to the list
var bar = function( value1, value2 ){
console.log( 'foobar');
}
var callbacks = $.Callbacks();
// add the log method to the callbacks list
callbacks.add( foo );
// determine which callbacks are in the list
console.log( callbacks.has( foo ) ); // true
console.log( callbacks.has( bar ) ); // false