Collections of useful macros for wasm

Examples

rust use wasm_macro::*; //location_assign onclick:move|_|{ location_assign!("/demo");// nevigate to /demo } //location_herf onclick:move|_|{ let herf = location_herf!(); info!("{}",herf); //get current location herf } //location_reload onclick:move|_|{ location_reload!(); //reload current location } //query_selector onclick:move|_|{ let main_div = document_querySelector!(".main"); match main_div{ Some(div) => { div.append_child(&document_create_element!("div").clone_node().unwrap()); }, None => {}, } } //query_selector_all onclick:move|_|{ let main_div = document_query_selector_all!(".main"); match main_div.get(0){ //frist of NodeList Some(div) => { div.append_child(&document_create_element!("div").clone_node().unwrap()); }, None => {}, } // get inner_html onclick:move|_|{ info!("{:?}", element_inner_html!(".main")); } //get inner_html onclick:move|_|{ element_set_inner_html!(".main","<h1>hello</h1>"); }