Latest web development tutorials

jQuery callbacks.fireWith () method

jQuery Misc Methods jQuery Misc Methods

Examples

Access to a given context "window" and the array parameters in all callback call list

$ (Function () { // Will be added to the list a simple function var log = function ( value1, value2 ) { alert ( "Received:" + value1 + " ," + value2 );}; Var . callbacks = $ Callbacks (); // add the function to the list callbacks. add ( log ); // Use the context "window" call the callback list // And a parameter array callbacks. fireWith ( window, [ "foo", " bar"]); // output: "Received: foo, bar" })

try it"

Definition and Usage

callbacks.fireWith () function for a given context and parameters to access a list of all the callbacks.


grammar

callbacks.fireWith( [context ] [, args ] )

参数 描述
context 该回调列表中被触发的上下文的一个引用
args 回传给回调列表的一个参数或参数列表


jQuery Misc Methods jQuery Misc Methods