返回值:Booleancallbacks.fired()
判断回调函数是否至少被调用过一次。
-
1.7 新增callbacks.fired()
示例
使用 callbacks.fired() 来判断回调函数列表中的回调函数是否至少被调用过一次:
// a sample logging function to be added to a callbacks list
var foo = function( value ){
console.log( 'foo:' + value );
}
var callbacks = $.Callbacks();
// add the function 'foo' to the list
callbacks.add( foo );
// fire the items on the list
callbacks.fire( 'hello' ); // outputs: 'foo: hello'
callbacks.fire( 'world '); // outputs: 'foo: world'
// test to establish if the callbacks have been called
console.log( callbacks.fired() );