1 line
1.3 KiB
JSON
1 line
1.3 KiB
JSON
{"name":"callbacks.fire","type":"method","title":"callbacks.fire()","deprecated":null,"removed":null,"desc":"Call all of the callbacks with the given arguments","categories":["callbacks-object","version/1.7"],"entries":[{"return":"Callbacks","signatures":{"added":"1.7","argument":{"desc":"The argument or list of arguments to pass back to the callback list.","name":"arguments","type":"Anything"}},"examples":{"desc":"Use <code>callbacks.fire()</code> to invoke the callbacks in a list with any arguments that have been passed:","code":"\n// A sample logging function to be added to a callbacks list\nvar foo = function( value ) {\n console.log( \"foo:\" + value );\n};\n\nvar callbacks = $.Callbacks();\n\n// Add the function \"foo\" to the list\ncallbacks.add( foo );\n\n// Fire the items on the list\ncallbacks.fire( \"hello\" ); // Outputs: \"foo: hello\"\ncallbacks.fire( \"world\" ); // Outputs: \"foo: world\"\n\n// Add another function to the list\nvar bar = function( value ){\n console.log( \"bar:\" + value );\n};\n\n// Add this function to the list\ncallbacks.add( bar );\n\n// Fire the items on the list again\ncallbacks.fire( \"hello again\" );\n// Outputs:\n// \"foo: hello again\"\n// \"bar: hello again\"\n"},"longdesc":"\n <p>This method returns the Callbacks object onto which it is attached (<code>this</code>).</p>\n "}]} |