napi_create_reference
NAPI_EXTERN napi_status napi_create_reference(napi_env env,
napi_value value,
uint32_t initial_refcount,
napi_ref* result);
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] value
:正在为其创建引用的napi_value
。¥
[in] value
: Thenapi_value
for which a reference is being created. -
[in] initial_refcount
:新引用的初始引用计数。¥
[in] initial_refcount
: Initial reference count for the new reference. -
[out] result
:napi_ref
指向新的引用。¥
[out] result
:napi_ref
pointing to the new reference.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
该 API 对传入的值创建一个具有指定引用计数的新引用。
¥This API creates a new reference with the specified reference count to the value passed in.