Skip to content

Commit 0ad37fd

Browse files
committed
feat: create_element_fn and create_element_fn_mut
1 parent d83ebab commit 0ad37fd

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/element.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,24 @@ crate::macro_import::wasm_bindgen_react! {
1717
props: JsValue,
1818
children: js_sys::Array,
1919
) -> Element;
20+
21+
/// # Safety
22+
///
23+
/// the function in `element_type` closure should live longer enough
24+
#[wasm_bindgen(variadic, js_namespace = React, js_name = createElement)]
25+
pub unsafe fn create_element_fn(
26+
element_type: &Closure<dyn Fn(js_sys::Object) -> Element>,
27+
props: JsValue,
28+
children: js_sys::Array,
29+
) -> Element;
30+
31+
/// # Safety
32+
///
33+
/// the function in `element_type` closure should live longer enough
34+
#[wasm_bindgen(variadic, js_namespace = React, js_name = createElement)]
35+
pub unsafe fn create_element_fn_mut(
36+
element_type: &Closure<dyn FnMut(js_sys::Object) -> Element>,
37+
props: JsValue,
38+
children: js_sys::Array,
39+
) -> Element;
2040
}

0 commit comments

Comments
 (0)