leptos_use/utils/js.rs
1#[macro_export]
2macro_rules! js {
3 ($attr:literal in $($obj:tt)*) => {
4 wasm_bindgen::JsValue::from($attr).js_in($($obj)*)
5 };
6 ($obj:ident[$attr:literal] = $($val:tt)*) => {
7 let _ = js_sys::Reflect::set(&$obj, &$attr.into(), &($($val)*).into());
8 };
9 ($obj:ident[$attr:literal]) => {
10 js_sys::Reflect::get(&$obj, &$attr.into())
11 };
12}
13
14#[macro_export]
15macro_rules! js_fut {
16 ($($obj:tt)*) => {
17 wasm_bindgen_futures::JsFuture::from($($obj)*)
18 };
19
20}