napi_async_execute_callback
与支持异步操作的函数一起使用的函数指针。回调函数必须满足以下签名:
¥Function pointer used with functions that support asynchronous operations. Callback functions must satisfy the following signature:
typedef void (*napi_async_execute_callback)(napi_env env, void* data);
此函数的实现必须避免进行执行 JavaScript 或与 JavaScript 对象交互的 Node-API 调用。Node-API 调用应该在 napi_async_complete_callback
中。不要使用 napi_env
参数,因为它可能会导致 JavaScript 的执行。
¥Implementations of this function must avoid making Node-API calls that execute
JavaScript or interact with JavaScript objects. Node-API calls should be in the
napi_async_complete_callback
instead. Do not use the napi_env
parameter as
it will likely result in execution of JavaScript.