Type Alias freya_elements::events::TouchEvent

source ·
pub type TouchEvent = Event<TouchData>;

Aliased Type§

struct TouchEvent {
    pub data: Rc<TouchData>,
    /* private fields */
}

Fields§

§data: Rc<TouchData>

The data associated with this event

Implementations

§

impl<T> Event<T>

pub fn map<U, F>(&self, f: F) -> Event<U>
where U: 'static, F: FnOnce(&T) -> U,

Map the event data to a new type

§Example
rsx! {
   button {
      onclick: move |evt: Event<FormData>| {
         let data = evt.map(|data| data.value());
         assert_eq!(data.inner(), "hello world");
      }
   }
}

pub fn cancel_bubble(&self)

👎Deprecated: use stop_propagation instead

Prevent this event from continuing to bubble up the tree to parent elements.

§Example
rsx! {
    button {
        onclick: move |evt: Event<MouseData>| {
            evt.cancel_bubble();
        }
    }
}

pub fn stop_propagation(&self)

Prevent this event from continuing to bubble up the tree to parent elements.

§Example
rsx! {
    button {
        onclick: move |evt: Event<MouseData>| {
            evt.stop_propagation();
        }
    }
}

pub fn data(&self) -> Rc<T>

Get a reference to the inner data from this event

rsx! {
    button {
        onclick: move |evt: Event<MouseData>| {
            let data = evt.inner.clone();
            cx.spawn(async move {
                println!("{:?}", data);
            });
        }
    }
}

Trait Implementations

§

impl<T> Clone for Event<T>
where T: ?Sized,

§

fn clone(&self) -> Event<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<T> Debug for Event<T>
where T: Debug,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<T> Deref for Event<T>

§

type Target = Rc<T>

The resulting type after dereferencing.
§

fn deref(&self) -> &<Event<T> as Deref>::Target

Dereferences the value.