napi_create_strong_reference

Function napi_create_strong_reference 

Source
pub unsafe extern "C" fn napi_create_strong_reference(
    env: napi_env,
    value: napi_value,
    result: *mut napi_strong_ref,
) -> napi_status
Available on crate features napi and api-21 only.
Expand description

Creates a strong reference for an ArkTS object to extend its lifespan. The caller needs to manage the reference lifespan.

§Arguments

  • env - Current running virtual machine context.

  • value - The napi_value that is being referenced.

  • result - napi_strong_ref pointing to the new strong reference.

§Returns

  • Returns the function execution status. [napi_ok] If the function executed successfully.

[napi_invalid_arg] If env, value or result is nullptr.

Available since API-level: 21