Skip to main content

call_function

Function call_function 

Source
pub unsafe fn call_function(
    cx: *mut JSContext,
    func: Value,
    this_obj: *mut JSObject,
    args: &[Value],
) -> Result<JsValue, JsError>
Expand description

Safely call a JS function value with the given arguments.

Returns Ok(JsValue) on success, Err(JsError) if the call throws.

§Safety

cx must be a valid JSContext. func must be a callable JS value. All args items must be valid JSVal.