[−][src]Function seed::app::streams::document_event
pub fn document_event<MsU>(
trigger: impl Into<Ev>,
handler: impl FnOnce(Event) -> MsU + Clone + 'static
) -> impl Stream<Item = MsU>
Stream Document
web_sys::Event
s.
Handler has to return Msg
, Option<Msg>
or ()
.
Example
orders.stream(streams::document_event(Ev::SelectionChange, |_| Msg::OnSelection)); orders.stream_with_handle(streams::document_event(Ev::SelectionChange, |_| log!("Selection changed!")));
Panics
Panics when the handler doesn't return Msg
, Option<Msg>
or ()
.
(It will be changed to a compile-time error).