pub unsafe extern "C" fn napi_add_finalizer(
env: napi_env,
js_object: napi_value,
native_object: *mut c_void,
finalize_cb: napi_finalize,
finalize_hint: *mut c_void,
result: *mut napi_ref,
) -> napi_statusAvailable on crate features
napi and api-11 only.Expand description
Adds a ‘napi_finalize’ callback, which will be called when the ArkTS object is garbage-collected.
§Arguments
-
env- Current running virtual machine context. -
js_object- The ArkTS object value. -
native_object- Native object to bind with the ArkTS object. -
finalize_cb- Native callback that can be used to free the native object when the ArkTS object is garbage-collected. -
finalize_hint- Optional contextual hint that is passed to the finalize callback. -
result- Optional reference of the ArkTS object.
§Returns
- Return the function execution status.
Available since API-level: 11