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 moreAuto Trait Implementations§
impl Freeze for ListenerSite
impl RefUnwindSafe for ListenerSite
impl Send for ListenerSite
impl Sync for ListenerSite
impl Unpin for ListenerSite
impl UnsafeUnpin for ListenerSite
impl UnwindSafe for ListenerSite
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.