Expand description
Runtime event dispatch (phase 4): input messages -> DOM events ->
propagation, one pass per event over every installed host. See
dom_events::deliver_input_events.
Runtime event dispatch for the dynamic DOM API (phase 4).
These systems turn the input pipeline’s typed messages (clicks, pointer
moves, wheel, keys, focus changes, text commits, scroll) into DOM events
and route each one through the capture -> target -> bubble propagation
driver in crate::event, once, whatever the number of script hosts the
app runs. A handler bound with n.on(type, handler) runs here, in the host
that bound it or natively; commands it queues are forwarded onto the
ScriptCommandEvent bus so the normal appliers pick them up.
The full event set: click, dblclick, pointerdown / pointerup /
pointermove / pointerenter / pointerleave, wheel, keydown /
keyup, input, change, focus, blur, submit, scroll.
Sources and current limitations:
- Pointer events target the entity currently under the cursor (
Hovered);pointerenter/pointerleavecome from the hover marker transitions. keydowntargets the focused entity (from the input router’sFocusedKey);keyuptargets the focused entity. With nothing focused both go to the document root, the way a browser sends them to the body, so a listener on the document hears app-wide shortcuts.inputfires per edit, from theTextEditAppliedsignal the text pipeline raises (or a page, whose fields the browser edits): one event per keystroke, paste, or IME commit that changes the text, at most one per entity per tick, carrying the field’s text after the edit. A pure caret move is not an edit and fires nothing.changeandsubmitfire on commit, from the input router’sTextInputCommittedsignal;submitis the Enter-commit on a single-line input.scrollcomes from a changed scroll offset and does not bubble.
Default actions: only click (link navigation via <a href>) and
submit (form submission) have one. prevent_default on a click
records the target so the runtime’s anchor-navigation executor skips it;
submit’s default is reserved (there is no form-submission model yet).
Structs§
- Event
Host - How the dispatch reaches one installed host: offer it a handler token, and forward the commands its handlers queued.
- Event
Hosts - The hosts DOM events are delivered into, one entry per installed host. Empty for an app with no script: native (C-ABI and SDK) handlers still run.
- Pending
DomEvents - The DOM events read from this tick’s input, waiting for delivery.
Functions§
- deliver_
input_ events - Deliver the pointer, click, wheel and key events read this tick.
- deliver_
state_ events - Deliver the focus, hover, edit, commit and scroll events read this tick.
- queue_
pointer_ and_ key_ events - Read this tick’s pointer, click, wheel and key input as DOM events, for
deliver_input_events. Pointer events target the hovered entity; key events target the focused entity, or the document root when nothing is focused. - queue_
state_ events - Read this tick’s focus, hover, edit, commit and scroll changes as DOM
events, for
deliver_state_events. - register_
dom_ event_ messages - Register every input message the DOM event queues read, where the world does not have it yet.
- register_
event_ host - Put the host stored as the resource
Hon the list DOM events are delivered into.