加载中...

callbacks.disable()1.7+


概述    callbacks.disable()

返回值:Callbacks

描述:禁用回调列表中的回调

  • V : 1.7callbacks.disable()

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

此方法返回绑定它的那个回调对象(this).

示例

实例

使用 callbacks.disable() 禁用回调列表:

jQuery 代码:
  1. // a sample logging function to be added to a callbacks list
  2. var foo = function( value ){
  3. console.log( value );
  4. }
  5. var callbacks = $.Callbacks();
  6. // add the above function to the list
  7. callbacks.add( foo );
  8. // fire the items on the list
  9. callbacks.fire( 'foo' ); // outputs: foo
  10. // disable further calls being possible
  11. callbacks.disable();
  12. // attempt to fire with 'foobar' as an argument
  13. callbacks.fire( 'foobar' ); // foobar isn't output

还没有评论.