Latest web development tutorials

jQuery callbacks.fire () method

jQuery Misc Methods jQuery Misc Methods

Examples

Incoming calls all parameters specified callback

$ (Function () { // Will be added to the list a simple function var foo = function ( value ) { alert ( "Foo:" + value );}; Var . callbacks = $ Callbacks (); // add the function "foo" to the list callbacks. add ( foo ); // Parameters passed to call all the callback list callbacks. fire ( "Hello" ); // Output: "foo: hello" callbacks. fire ( "World" ); // Output: "foo: world" // Add another function to the list var bar = function ( value ) { alert ( "Bar:" + value );}; // Add this function to the list callbacks. add ( bar ); // Parameters passed to call all the callback list callbacks. fire ( "Hello again" ); // Output: // "Foo: hello again" // "Bar: hello again" })

try it"

Definition and Usage

callbacks.fire () function is used to specify the parameters of the incoming call to all callbacks.

This method returns a callback object to the callback list it binding.


grammar

callbacks.fire( arguments )

参数 描述
arguments 任意类型 传回给回调列表的参数或参数列表


jQuery Misc Methods jQuery Misc Methods