bloom_html/event.rs
1/// Event handlers are basically just closures that take a web_sys::Event as an argument.
2/// This type only provides a convenience for implementing the actual render-functions.
3pub type EventHandler = Box<dyn Fn(web_sys::Event) + Send + Sync + 'static>;
4
5#[cfg(test)]
6mod tests {
7
8 use crate::{tag::button, HtmlElement};
9
10 #[test]
11 fn build_button() {
12 let button: HtmlElement = button().on("click", |_| {}).build();
13
14 let _cb = button.callbacks().get("click");
15 }
16}