callbacks.fire(arguments) runs every handler on a jQuery Callbacks list (since jQuery 1.7), in add order, with the arguments you pass. It returns the same Callbacks object for chaining.
Remember
callbacks.add(foo)
callbacks.fire("hello") // foo("hello")
callbacks.fire("world") // foo("world") again
add() → queue handlers
fire() → run them now
returns the Callbacks object (chainable)
Build a list, add handlers, then fire when the event or step is ready.
Create a list with $.Callbacks() (optional flags such as once).
Register handlers with add(fn).
Call fire(arg1, arg2, …) to run every handler with those args.
Call fire() again anytime (unless the list uses once or was disabled).
Piece
Required?
Role
Callbacks object
Yes
From $.Callbacks()
arguments
No
Values forwarded to each handler
Return
—
Same Callbacks object (chainable)
Pseudocode
Pseudocode
function fire(callbacks, args...):
if callbacks is disabled: return callbacks
if once and already fired: return callbacks
for each handler in callbacks.list (in order):
handler(args...)
if stopOnFalse and handler returned false: break
mark list as fired
return callbacks
Reference
Cheat Sheet
Keep these facts handy when publishing to a Callbacks list.
var lines = [];
var foo = function (value) { lines.push("foo: " + value); };
var bar = function (value) { lines.push("bar: " + value); };
var callbacks = $.Callbacks();
callbacks.add(foo);
callbacks.add(bar);
callbacks.fire("hello again");
console.log(lines.join("\\n"));
// foo: hello again
// bar: hello again
Create the list with $.Callbacks("once") only when a single publish is intended.
stop
stopOnFalse can halt the chain
If a handler returns false and the list uses that flag, later handlers are skipped.
order
Add before fire (usually)
Late add() joins future fires. With memory, a late add can also replay the last arguments immediately.
Compatibility
Browser Support
callbacks.fire() has shipped since jQuery 1.7 with $.Callbacks. It works in all modern browsers with jQuery loaded.
✓ jQuery 1.7+
callbacks.fire()
Core Callbacks publisher — invoke every registered handler with optional arguments.
100%Browser support
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
callbacks.fire()Excellent
Bottom line: Call fire(args…) to publish. Use fireWith for a custom this, and remember disable() / once change later fires.
Analysis
Performance Notes
Approach
Cost
Best for
fire(args)
O(n) handlers
Publishing to the full list
add(fn)
O(1)*
Subscribing handlers
Heavy work inside handlers
Blocks the pass
Keep callbacks light; defer work
*Unless the list uses unique. Prefer lean handlers — one slow callback delays every later subscriber in the same fire().
Remember
Key Takeaways
Role:fire() publishes — add() subscribes.
Args: values passed to fire() reach every handler.
Flags:once, memory, and stopOnFalse change fire behavior.
Context: use fireWith when handlers need a specific this.
One line:fire(args…) runs every registered handler in order — unless the list is disabled or already spent under once.
Frequently Asked Questions
fire() calls every function currently registered on the Callbacks list, in registration order. Any arguments you pass to fire() are forwarded to each handler. It returns the same Callbacks object for chaining.
Use fire(args…) when you only need to pass arguments. Use fireWith(context, argsArray) when handlers must run with a custom this value (for example a DOM element or plugin object).
fire() completes with no errors and no handlers run. Safe, but easy to miss if you expected subscribers.
No. After disable(), fire() is a no-op. Check disabled() when debugging silent fires.
Yes on a default list — each fire() runs all current handlers again. With $.Callbacks("once"), only the first fire() has effect.
Yes. After a successful fire, fired() returns true. That matters for flags like memory (late add() can replay the last arguments).