Struct virtual_node::event::EventsByNodeIdx [−][src]
pub struct EventsByNodeIdx { /* fields omitted */ }Expand description
Node’s in a VirtualNode tree are indexed depth first, where the first node is index 0, it’s first child node is index 1, and the first child’s first child is index 2.
When we create a DOM node, we store all of it’s closures and all of it’s children’s closures in this map.
We also set a .__nodeIdx property on nodes that have one or more events.
Percy will sometimes use event delegation, and other times attach events directly to DOM elements, depending on the kind of event.
The .__nodeIdx property is used to power event delegation, so that the main event handler can
look up the callback.
Cloning
EventsByNodeIdx can be cheaply cloned and passed around. Clones share the same inner data.
Implementations
Unique for every PercyDom so that if multiple instances of PercyDom are nested their event delegation handlers don’t collide.
Insert a newly tracked event.
Panics
Panics if the event_name is delegated and the event is not, or vice versa.
pub fn overwrite_event_attrib_fn(
&self,
node_idx: u32,
event_name: &EventName,
event: EventHandler
)
pub fn overwrite_event_attrib_fn(
&self,
node_idx: u32,
event_name: &EventName,
event: EventHandler
)
Remove all of the events from one node ID and add them to another node ID.
Remove a managed event.
pub fn get_event_handler(
&self,
node_id: &u32,
event_name: &EventName
) -> Option<EventHandler>
pub fn get_event_handler(
&self,
node_id: &u32,
event_name: &EventName
) -> Option<EventHandler>
Get the event handler for a node.
pub fn remove_event_handler(
&self,
node_id: &u32,
event_name: &EventName
) -> Option<ManagedEvent>
pub fn remove_event_handler(
&self,
node_id: &u32,
event_name: &EventName
) -> Option<ManagedEvent>
Remove an event handler.
Remove all event handlers for a node.
Trait Implementations
Auto Trait Implementations
impl !RefUnwindSafe for EventsByNodeIdx
impl !Send for EventsByNodeIdx
impl !Sync for EventsByNodeIdx
impl Unpin for EventsByNodeIdx
impl !UnwindSafe for EventsByNodeIdx
Blanket Implementations
Mutably borrows from an owned value. Read more