Raxol. Core. Runtime. Events. Bubbler
(Raxol v2.6.0)
View Source
Implements capture and bubbling event dispatch through the view tree.
The full event flow follows the W3C model:
Capture phase (root -> target): walks down from root, checking
:on_capturehandlers. A capture handler can intercept the event before it reaches the target.Target + Bubble phase (target -> root): the focused element and its ancestors get a chance to handle via inline handlers (
:on_click,:on_event,:on_change) and componenthandle_event/3.:passthroughcontinues to the next ancestor.
If no handler in either phase consumes the event, it falls through to
the app-level update/2.
Summary
Functions
Attempts to bubble an event through the view tree starting at the focused element.
Does NOT run the capture phase. Use dispatch/4 for the full cycle.
Dispatches an event through the full capture + bubble cycle.
Finds the path from the root to the target element (inclusive). Returns the path in bottom-up order (target first, root last) for bubbling. Returns nil if the element is not found.
Types
Functions
@spec bubble(Raxol.Core.Events.Event.t(), element(), term(), map()) :: dispatch_result()
Attempts to bubble an event through the view tree starting at the focused element.
Does NOT run the capture phase. Use dispatch/4 for the full cycle.
Returns:
{:handled, result}if a component consumed the event{:commands, commands}if a component returned commands to process:passthroughif no component handled the event
@spec dispatch(Raxol.Core.Events.Event.t(), element(), term(), map()) :: dispatch_result()
Dispatches an event through the full capture + bubble cycle.
Returns:
{:handled, result}if a handler consumed the event{:commands, commands}if a handler returned commands:passthroughif no handler consumed the event
Finds the path from the root to the target element (inclusive). Returns the path in bottom-up order (target first, root last) for bubbling. Returns nil if the element is not found.