加载中...

callbacks.fired()1.7+


概述    callbacks.fired()

返回值:Boolean

描述:确定回调是否至少已经调用一次。

  • V : 1.7callbacks.fired()

    • 这个方法不接受任何参数

示例

实例

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

jQuery 代码:
  1. // a sample logging function to be added to a callbacks list
  2. var foo = function( value ){
  3. console.log( 'foo:' + value );
  4. }
  5. var callbacks = $.Callbacks();
  6. // add the function 'foo' to the list
  7. callbacks.add( foo );
  8. // fire the items on the list
  9. callbacks.fire( 'hello' ); // outputs: 'foo: hello'
  10. callbacks.fire( 'world '); // outputs: 'foo: world'
  11. // test to establish if the callbacks have been called
  12. console.log( callbacks.fired() );

还没有评论.