Function ev

Source
pub fn ev<Ms: 'static, MsU: 'static>(
    trigger: impl Into<Ev>,
    handler: impl FnOnce(Event) -> MsU + 'static + Clone,
) -> EventHandler<Ms>
Expand description

Create an event handler that accepts a closure, and passes a web_sys::Event, allowing full control of event-handling.

Handler has to return Msg, Option<Msg> or ().

§Panics

Panics when the handler doesn’t return Msg or (). (It will be changed to a compile-time error).