Struct hotdrink_wasm::event::event_handler::EventHandler[][src]

pub struct EventHandler<T, E> { /* fields omitted */ }

The main event handler containing the callbacks for variables.

Implementations

impl<T: Into<JsValue> + Clone + Debug, E: Display + Debug> EventHandler<T, E>[src]

pub fn new() -> Self[src]

Construct a new event handler that reacts to no events.

pub fn set_on_pending(
    &mut self,
    component: &str,
    variable: &str,
    on_pending: Function
) -> Option<()>
[src]

Sets the callback to call when the specified variable starts waiting for a new value.

pub fn set_on_ready(
    &mut self,
    component: &str,
    variable: &str,
    on_ready: Function
) -> Option<()>
[src]

Sets the callback to call when the specified variable succeeds in getting a new value.

pub fn set_on_error(
    &mut self,
    component: &str,
    variable: &str,
    on_error: Function
) -> Option<()>
[src]

Sets the callback to call when the specified variable fails to get a new value.

pub fn unsubscribe(&mut self, component: &str, variable: &str)[src]

Removes the callback for a specific variable from the event handler.

pub fn handle_event(&mut self, event: JsEvent<T, E>) -> Result<(), JsValue>[src]

Handles an event based on the attached callbacks.

Trait Implementations

impl<T: Clone, E: Clone> Clone for EventHandler<T, E>[src]

impl<T: Debug, E: Debug> Debug for EventHandler<T, E>[src]

impl<T, E> Default for EventHandler<T, E>[src]

impl<T: Eq, E: Eq> Eq for EventHandler<T, E>[src]

impl<T: PartialEq, E: PartialEq> PartialEq<EventHandler<T, E>> for EventHandler<T, E>[src]

impl<T, E> StructuralEq for EventHandler<T, E>[src]

impl<T, E> StructuralPartialEq for EventHandler<T, E>[src]

Auto Trait Implementations

impl<T, E> RefUnwindSafe for EventHandler<T, E> where
    E: RefUnwindSafe,
    T: RefUnwindSafe

impl<T, E> !Send for EventHandler<T, E>

impl<T, E> !Sync for EventHandler<T, E>

impl<T, E> Unpin for EventHandler<T, E> where
    E: Unpin,
    T: Unpin

impl<T, E> UnwindSafe for EventHandler<T, E> where
    E: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

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

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

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

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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.