callbacks.fired()
确定是否已经至少调用了一次回调。
callbacks.fired()
- 这个方法不接受任何参数
- 返回: Boolean
Example
使用callbacks.fired()
确定回调是否至少已经调用一次:
// a sample logging function to be added to a callbacks listvar 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() );