[−][src]Struct gloo_events::EventListenerOptions
Specifies options for EventListener::new_with_options
and
EventListener::once_with_options
.
Default
EventListenerOptions { phase: EventListenerPhase::Bubble, passive: true, }
Examples
Sets phase
to EventListenerPhase::Capture
, using the default for the rest:
let options = EventListenerOptions::run_in_capture_phase();
Sets passive
to false
, using the default for the rest:
let options = EventListenerOptions::enable_prevent_default();
Specifies all options:
let options = EventListenerOptions { phase: EventListenerPhase::Capture, passive: false, };
Fields
phase: EventListenerPhase
The phase that the event listener should be run in.
passive: bool
If this is true
then performance is improved, but it is not possible to use
event.prevent_default()
.
If this is false
then performance might be reduced, but now it is possible to use
event.prevent_default()
.
You can read more about the performance costs here.
Methods
impl EventListenerOptions
[src]
pub fn run_in_capture_phase() -> Self
[src]
Returns an EventListenerOptions
with phase
set to EventListenerPhase::Capture
.
This is the same as:
EventListenerOptions { phase: EventListenerPhase::Capture, ..Default::default() }
pub fn enable_prevent_default() -> Self
[src]
Returns an EventListenerOptions
with passive
set to false
.
This is the same as:
EventListenerOptions { passive: false, ..Default::default() }
Trait Implementations
impl Default for EventListenerOptions
[src]
impl Clone for EventListenerOptions
[src]
fn clone(&self) -> EventListenerOptions
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for EventListenerOptions
[src]
impl Debug for EventListenerOptions
[src]
Auto Trait Implementations
impl Send for EventListenerOptions
impl Unpin for EventListenerOptions
impl Sync for EventListenerOptions
impl UnwindSafe for EventListenerOptions
impl RefUnwindSafe for EventListenerOptions
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,