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] cbinfo:传入回调函数的回调信息。[in-out] argc:指定提供的argv数组的长度,并接收实际的参数数量。通过传递NULL可以可选地忽略argc。[out] argv:一个napi_value类型的 C 数组,用于复制传入的参数。如果参数数量多于提供的数量,则只复制请求数量的参数。如果提供的参数少于声明的数量,其余的argv将用表示undefined的napi_value值填充。argv可以通过传入NULL来选择性地忽略。[out] thisArg:接收调用的 JavaScriptthis参数。可以通过传入NULL来选择性地忽略thisArg。[out] data:接收回调的数据指针。可以通过传递NULL来选择性地忽略data。
如果 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.