jQuery callbacks.fireWith()Method
Example
Call all callbacks in the list with the given context "window" and an array argument
$(function () {
//A simple function that will be added to the list
var log = function( value1, value2 ) {
alert( "Received: " + value1 + "," + value2 );
};
var callbacks = $.Callbacks();
//Add a function to the list
callbacks.add( log );
//Call the callback list with the context "window"
//and an array argument
callbacks.fireWith( window, ["foo","bar"]);
//Output: "Received: foo, bar"
})
Try it yourself »
Definition and Usage
The callbacks.fireWith() function calls all callbacks in the list with the given context and arguments.
Syntax
callbacks.fireWith( [context ] [, args ] )
| Parameters | Description |
|---|---|
| context | A reference to the context in which the callback list is fired |
| args | An argument or list of arguments to pass back to the callback list |
Other extensions
jQuery Miscellaneous Methods