napi_get_cb_info
napi_status napi_get_cb_info(napi_env env,
napi_callback_info cbinfo,
size_t* argc,
napi_value* argv,
napi_value* thisArg,
void** data)
-
[in] env
:调用 API 的环境。¥
[in] env
: The environment that the API is invoked under. -
[in] cbinfo
:传递给回调函数的回调信息。¥
[in] cbinfo
: The callback info passed into the callback function. -
[in-out] argc
:指定所提供的argv
数组的长度并接收参数的实际计数。argc
可以选择性地通过传递NULL
来忽略。¥
[in-out] argc
: Specifies the length of the providedargv
array and receives the actual count of arguments.argc
can optionally be ignored by passingNULL
. -
[out] argv
:参数将被复制到的napi_value
的 C 数组。如果参数数量多于提供的数量,则只复制请求数量的参数。如果提供的参数比声明的少,则argv
的其余部分将填充代表undefined
的napi_value
值。argv
可以选择性地通过传递NULL
来忽略。¥
[out] argv
: C array ofnapi_value
s to which the arguments will be copied. If there are more arguments than the provided count, only the requested number of arguments are copied. If there are fewer arguments provided than claimed, the rest ofargv
is filled withnapi_value
values that representundefined
.argv
can optionally be ignored by passingNULL
. -
[out] thisArg
:接收调用的 JavaScriptthis
参数。thisArg
可以选择性地通过传递NULL
来忽略。¥
[out] thisArg
: Receives the JavaScriptthis
argument for the call.thisArg
can optionally be ignored by passingNULL
. -
[out] data
:接收回调的数据指针。data
可以选择性地通过传递NULL
来忽略。¥
[out] data
: Receives the data pointer for the callback.data
can optionally be ignored by passingNULL
.
如果 API 成功,则返回 napi_ok
。
¥Returns napi_ok
if the API succeeded.
此方法在回调函数中用于检索有关调用的详细信息,例如来自给定回调信息的参数和 this
指针。
¥This method is used within a callback function to retrieve details about the
call like the arguments and the this
pointer from a given callback info.