dispatch_event
immediately dispatches a DOM CustomEvent in the browser. These events bubble up through the DOM and are cancelable.window
scope) dispatch_event
will also trigger a jQuery event with the same name.detail
parameter.detail
parameter will convert user_id
to userId
- snake_case to camelCase - for JS consumption on the client.dispatch_event
to notify the client when long-running server processes are completed. You can see an example in Leveraging Stimulus.dispatch_event
.