当前位置主页 > jquery文档 > callbacks.fired()

callbacks.fired() | jQuery API

2015-01-23 

返回值:Booleancallbacks.fired()

V1.7概述

用给定的参数调用所有的回调。

示例

描述:

使用callbacks.fired() 确定,如果列表中的回调至少有一次被呼叫

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() );
Previous:
上一篇:callbacks.fire(arguments)
Next:
下一篇:callbacks.fireWith([c] [,a])
返回顶部