总有人间一两风,填我十万八千梦

jQuery .callbacksfired() 用法 手册 | 示例代码

jQuery开发手册 归档 178℃ 0评论

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

  • 添加的版本: 1.7callbacks.fired()

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

Example

使用 callbacks.fired() 确定回调是否至少已经调用一次:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
// 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() );

转载请注明:悠然品鉴 » jQuery .callbacksfired() 用法 手册 | 示例代码

喜欢 (0)or分享 (0)
发表我的评论
取消评论

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址