首頁  >  回調(diào)函數(shù)  > cal.fired()

返回值:Booleancallbacks.fired()

V1.7jQuery 使用callbacks.fired() 方法概述

用給定的參數(shù)調(diào)用所有的回調(diào)。

示例

描述:

使用callbacks.fired() 確定,如果列表中的回調(diào)至少有一次被呼叫

jQuery 代碼:
// 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() );