pub trait When: AsRef<EventTarget> + Sized {
fn when<E: FromWasmAbi + 'static, F: FnMut(E) + 'static>(
self: &Rc<Self>,
event_type: &'static str,
callback: F
) -> Result<EventListener<Self, E>, JsError>;
}
Expand description
Trait for listening to events with a callback.
Required Methods§
sourcefn when<E: FromWasmAbi + 'static, F: FnMut(E) + 'static>(
self: &Rc<Self>,
event_type: &'static str,
callback: F
) -> Result<EventListener<Self, E>, JsError>
fn when<E: FromWasmAbi + 'static, F: FnMut(E) + 'static>(
self: &Rc<Self>,
event_type: &'static str,
callback: F
) -> Result<EventListener<Self, E>, JsError>
Run callback
when given event type occurs.