callbacks.fired()


html+div+css+天猫商城
html5+css3+京东手机网站
javascript+jquery+ajax
正则表达式+面向对象+js插件
2D+3D+触屏事件+Canvas+Svg
地理信息+本地存储+H5拖拽api
查看课程大纲

callbacks.fired()返回: Boolean

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

  • 添加的版本: 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() );