1use wasm_bindgen::prelude::*;
4use web_sys::{Element, Event};
5
6pub fn get_element_by_id(id: &str) -> Option<web_sys::Element> {
7 web_sys::window()?.document()?.get_element_by_id(id)
8}
9
10#[wasm_bindgen(module = "@material/base/component/index")]
11extern "C" {
12 pub type MDCComponent;
13
14 #[wasm_bindgen(method)]
15 pub fn listen(this: &MDCComponent, evt_type: &str, handler: &Closure<dyn FnMut(Event)>);
16
17 #[wasm_bindgen(method)]
18 pub fn unlisten(this: &MDCComponent, evt_type: &str, handler: &Closure<dyn FnMut(Event)>);
19
20 #[wasm_bindgen(method)]
21 pub fn destroy(this: &MDCComponent);
22}
23
24#[wasm_bindgen(module = "@material/ripple/index")]
25extern "C" {
26 #[wasm_bindgen(extends = MDCComponent)]
27 pub type MDCRipple;
28
29 #[wasm_bindgen(constructor)]
30 pub fn new(root: Element) -> MDCRipple;
31
32 #[wasm_bindgen(method, getter)]
33 pub fn unbounded(this: &MDCRipple) -> bool;
34
35 #[wasm_bindgen(method, setter)]
36 pub fn set_unbounded(this: &MDCRipple, unbounded: bool);
37
38 #[wasm_bindgen(method)]
39 pub fn activate(this: &MDCRipple);
40
41 #[wasm_bindgen(method)]
42 pub fn deactivate(this: &MDCRipple);
43
44 #[wasm_bindgen(method)]
45 pub fn layout(this: &MDCRipple);
46
47 #[wasm_bindgen(method)]
48 pub fn handle_focus(this: &MDCRipple);
49
50 #[wasm_bindgen(method)]
51 pub fn handle_blur(this: &MDCRipple);
52
53}