napi_get_instance_data


napi_status napi_get_instance_data(node_api_nogc_env env,
                                   void** data); 
  • [in] env:调用 Node-API 调用的环境。

    ¥[in] env: The environment that the Node-API call is invoked under.

  • [out] data:之前通过调用 napi_set_instance_data() 与当前运行的 Node.js 环境相关联的数据项。

    ¥[out] data: The data item that was previously associated with the currently running Node.js environment by a call to napi_set_instance_data().

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

此 API 检索以前通过 napi_set_instance_data() 与当前运行的 Node.js 环境关联的数据。如果没有设置数据,则调用成功,data 将设置为 NULL

¥This API retrieves data that was previously associated with the currently running Node.js environment via napi_set_instance_data(). If no data is set, the call will succeed and data will be set to NULL.