Events & Listeners
You can emit events from both your Wires and JavaScript. Superb!
Emitting Events
You can emit events from Actions, Templates, and JavaScript.
Actions
Using the emit method:
function someAction() {
emit( "taskAdded" );
}You can provide arguments to all listeners by passing an array as the second argument.
function someAction() {
emit( "taskAdded", [
"some task",
now()
] );
}Templates
Using the $emit() method:
JavaScript
Using the global cbwire.emit():
Listeners
You can register event listeners on a Wire by defining listeners.
JavaScript keys are case-sensitive. You can preserve the key casing in CFML by surrounding your listener names in quotations.
JavaScript
Listening to events that you emit in your Actions can be done using cbwire.on().
Last updated
Was this helpful?