pub enum ListenerSite {
Action {
component: Symbol,
action: Symbol,
argc: usize,
key: Option<Symbol>,
carries_value: bool,
once: Option<Symbol>,
},
Bind {
component: Symbol,
field: Symbol,
checked: bool,
},
DefaultToggle {
component: Symbol,
field: Symbol,
radio: bool,
},
CallbackProp {
component: Symbol,
prop: Symbol,
argc: usize,
key: Option<Symbol>,
once: Option<Symbol>,
},
ScrollNear {
component: Symbol,
action: Symbol,
},
}Expand description
One attached listener, as the dispatcher needs to call it back.
★ IT CARRIES WHAT TO CALL, NOT A CLOSURE. A module cannot hold a listener closure on the browser
tier — Map of Text to fn(…) is refused by that backend (“unsupported indirect call”), measured
rather than assumed. But the dispatcher never needed the closure: it needs to know WHICH handler
and FOR WHICH INSTANCE, and both of those are data. The closure stays where it belongs, on the
element, for the browser to call; this is the parallel record a driving verb resolves through.
Variants§
Action
on-<event>={action} and When "<sel>" is <event>: — run that action’s turn.
key is the KEY MODIFIER this listener waits for (on-keydown.enter → enter), or
None for a handler that answers any press. It is compared case-insensitively against
the key the dispatch carries, because a browser reports KeyboardEvent.key as "Enter"
while the author writes .enter — the reason the two ends meet at all.
Fields
carries_value: boolWhether the handler’s LAST parameter is what the event CARRIED rather than something captured where it was rendered. A dropped file’s name is not state and not a prop — it arrives with the event — so the arm reads the dispatcher’s value slot for it.
once: Option<Symbol>For an on-<event>.once handler, the render’s local holding the listener’s identity
(see once_spent_binding); the registration records it against the listener key and
the arm spends it.
Bind
bind={field} — store the delivered value, then repaint.
DefaultToggle
A click on a bound checkbox or radio. Not a listener the page wrote: it is the BROWSER’s
default action, which happens before any handler runs, and an in-process host performs it
itself (page_host’s Driver::toggle). Registered so the node-keyed lookup finds it like
any other.
CallbackProp
on-<event>={<callbackProp>} — a component’s own element calling a callback it was HANDED
rather than one of its own actions (docs/frontend.md’s “Passing actions down”). The arm
calls the prop’s trampoline (Parser::callback_trampoline) for the registering instance,
with the argc arguments the render recorded; key is the key modifier, as on
Self::Action.
ScrollNear
A scroll the page heard where When the user scrolls to the bottom: waits: the arm asks
the geometry how far the scrolled node is from its end, and runs the handler’s turn only
within 32px of it — the threshold is compiled LOGOS, the host only measures.
Trait Implementations§
Source§impl Clone for ListenerSite
impl Clone for ListenerSite
Source§fn clone(&self) -> ListenerSite
fn clone(&self) -> ListenerSite
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more