leptos_use/utils/
js.rs

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

#[macro_export]
macro_rules! js_fut {
    ($($obj:tt)*) => {
        wasm_bindgen_futures::JsFuture::from($($obj)*)
    };

}