napi_get_reference_value


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

这些方法中的 napi_value passed 是与引用相关的对象的句柄。

¥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] env: The environment that the API is invoked under.

  • [in] ref:我们请求对应的 Objectnapi_ref

    ¥[in] ref: napi_ref for which we requesting the corresponding Object.

  • [out] resultnapi_ref 引用的 Objectnapi_value

    ¥[out] result: The napi_value for the Object referenced by the napi_ref.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

如果仍然有效,则此 API 返回 napi_value,表示与 napi_ref 关联的 JavaScript Object。否则,结果将为 NULL

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