[][src]Struct gloo_events::EventListenerOptions

pub struct EventListenerOptions {
    pub phase: EventListenerPhase,
    pub passive: bool,
}

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]

impl Copy for EventListenerOptions[src]

impl Debug for EventListenerOptions[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]