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 fn new(
event_type: EventType,
source: EventSource,
target: DomNodeId,
timestamp: Instant,
data: EventData,
) -> Self
pub 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 fn stop_propagation(&mut self)
pub 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 fn stop_immediate_propagation(&mut self)
pub 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 fn prevent_default(&mut self)
pub 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 fn is_propagation_stopped(&self) -> bool
pub fn is_propagation_stopped(&self) -> bool
Check if propagation was stopped.
Sourcepub fn is_immediate_propagation_stopped(&self) -> bool
pub fn is_immediate_propagation_stopped(&self) -> bool
Check if immediate propagation was stopped.
Sourcepub fn is_default_prevented(&self) -> bool
pub 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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SyntheticEvent
impl Debug for SyntheticEvent
Source§impl PartialEq for SyntheticEvent
impl PartialEq for SyntheticEvent
impl StructuralPartialEq for SyntheticEvent
Auto Trait Implementations§
impl Freeze for SyntheticEvent
impl RefUnwindSafe for SyntheticEvent
impl Send for SyntheticEvent
impl Sync for SyntheticEvent
impl Unpin for SyntheticEvent
impl UnsafeUnpin for SyntheticEvent
impl UnwindSafe for SyntheticEvent
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,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more