pub struct EventContext { /* private fields */ }Expand description
Mutable dispatch state passed to event handlers.
Uses Cell for interior mutability — handlers can call stop_propagation()
etc. through a shared reference. Safe because dispatch is single-threaded.
§Chrome equivalence
| Chrome field | Kozan field |
|---|---|
event_phase_ | phase |
propagation_stopped_ | propagation_stopped |
immediate_propagation_stopped_ | immediate_stopped |
default_prevented_ | default_prevented |
current_target_ | current_target |
target_ | target |
Implementations§
Source§impl EventContext
impl EventContext
Sourcepub fn current_target(&self) -> u32
pub fn current_target(&self) -> u32
The node currently being processed in the dispatch path.
Sourcepub fn stop_propagation(&self)
pub fn stop_propagation(&self)
Stop propagation to subsequent nodes.
Remaining listeners on the current node still fire.
(Chrome: stopPropagation())
Sourcepub fn stop_immediate_propagation(&self)
pub fn stop_immediate_propagation(&self)
Stop propagation AND prevent remaining listeners on the current node.
(Chrome: stopImmediatePropagation())
Sourcepub fn prevent_default(&self)
pub fn prevent_default(&self)
Prevent the default action for this event.
Does NOT stop propagation — all listeners still fire.
(Chrome: preventDefault())
Sourcepub fn is_propagation_stopped(&self) -> bool
pub fn is_propagation_stopped(&self) -> bool
Was stop_propagation() or stop_immediate_propagation() called?
Sourcepub fn is_immediate_stopped(&self) -> bool
pub fn is_immediate_stopped(&self) -> bool
Was stop_immediate_propagation() called?
Sourcepub fn is_default_prevented(&self) -> bool
pub fn is_default_prevented(&self) -> bool
Was prevent_default() called?
Auto Trait Implementations§
impl !Freeze for EventContext
impl !RefUnwindSafe for EventContext
impl Send for EventContext
impl !Sync for EventContext
impl Unpin for EventContext
impl UnsafeUnpin for EventContext
impl UnwindSafe for EventContext
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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 moreSource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
Source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
Source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
Source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert