pub struct SyntheticEvent {
pub event_type: EventType,
pub source: EventSource,
pub phase: EventPhase,
pub target: DomNodeId,
pub current_target: DomNodeId,
pub timestamp: Instant,
pub data: EventData,
pub stopped: bool,
pub stopped_immediate: bool,
pub prevented_default: bool,
}Expand description
Unified event wrapper (similar to React’s SyntheticEvent).
All events in the system are wrapped in this structure, providing a consistent interface and enabling event propagation control.
Fields§
§event_type: EventTypeThe type of event
source: EventSourceWhere the event came from
phase: EventPhaseCurrent propagation phase
target: DomNodeIdTarget node that the event was dispatched to
current_target: DomNodeIdCurrent node in the propagation path
timestamp: InstantTimestamp when event was created
data: EventDataType-specific event data
stopped: boolWhether propagation has been stopped
stopped_immediate: boolWhether immediate propagation has been stopped
prevented_default: boolWhether default action has been prevented
Implementations§
Source§impl SyntheticEvent
impl SyntheticEvent
Sourcepub const fn new(
event_type: EventType,
source: EventSource,
target: DomNodeId,
timestamp: Instant,
data: EventData,
) -> Self
pub const fn new( event_type: EventType, source: EventSource, target: DomNodeId, timestamp: Instant, data: EventData, ) -> Self
Create a new synthetic event.
§Parameters
timestamp: Current time from(system_callbacks.get_system_time_fn.cb)()
Sourcepub const fn stop_propagation(&mut self)
pub const fn stop_propagation(&mut self)
Stop event propagation after the current phase completes.
This prevents the event from reaching handlers in subsequent phases (e.g., stopping during capture prevents bubble phase).
Sourcepub const fn stop_immediate_propagation(&mut self)
pub const fn stop_immediate_propagation(&mut self)
Stop event propagation immediately.
This prevents any further handlers from being called, even on the current target element.
Sourcepub const fn prevent_default(&mut self)
pub const fn prevent_default(&mut self)
Prevent the default action associated with this event.
For example, prevents form submission on Enter key, or prevents text selection on drag.
Sourcepub const fn is_propagation_stopped(&self) -> bool
pub const fn is_propagation_stopped(&self) -> bool
Check if propagation was stopped.
Sourcepub const fn is_immediate_propagation_stopped(&self) -> bool
pub const fn is_immediate_propagation_stopped(&self) -> bool
Check if immediate propagation was stopped.
Sourcepub const fn is_default_prevented(&self) -> bool
pub const fn is_default_prevented(&self) -> bool
Check if default action was prevented.
Trait Implementations§
Source§impl Clone for SyntheticEvent
impl Clone for SyntheticEvent
Source§fn clone(&self) -> SyntheticEvent
fn clone(&self) -> SyntheticEvent
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more