Example of callbacks.fired() in jQuery
March 30, 2013
fired() in jQuery is called on the list of callback. fired() checks that the callback method added in callback list has run or not at least one time. If callback method in callback list has run at least once, callbacks.fired() returns true otherwise false.We call it as
callbacks.fired()
<html> <body> <script src="http://code.jquery.com/jquery-1.9.1.js"></script> <script> var show = function( val ) { console.log(val); }; var callbacks = $.Callbacks(); callbacks.add( show ); console.log( callbacks.fired() ); callbacks.fire( "Hello World!" ); console.log( callbacks.fired() ); </script> </body> </html>
Output
Output in console will be as below.
false Hello World! true