napi_get_reference_value


NAPI_EXTERN napi_status napi_get_reference_value(napi_env env,
                                                 napi_ref ref,
                                                 napi_value* result); 

传入或传出这些方法的 napi_value 是与该引用相关的对象的句柄。

🌐 the napi_value passed in or out of these methods is a handle to the object to which the reference is related.

  • [in] env:调用该 API 时所处的环境。
  • [in] ref:请求其对应 Objectnapi_ref
  • [out] result:由 napi_ref 引用的 Object 对应的 napi_value

如果 API 成功,则返回 napi_ok

🌐 Returns napi_ok if the API succeeded.

如果仍然有效,该 API 会返回表示与 napi_ref 关联的 JavaScript Objectnapi_value。否则,结果将是 NULL

🌐 If still valid, this API returns the napi_value representing the JavaScript Object associated with the napi_ref. Otherwise, result will be NULL.