Function napi_h::bindgen_prelude::get_js_function
source · pub fn get_js_function(
env: &Env,
raw_fn: ExportRegisterCallback
) -> Result<JsFunction>
Expand description
Get JsFunction
from defined Rust fn
#[napi]
fn some_fn() -> u32 {
1
}
#[napi]
fn return_some_fn() -> Result<JsFunction> {
get_js_function(some_fn_js_function)
}
returnSomeFn()(); // 1