napi_finalize


用于附加组件提供的函数的函数指针类型,该函数允许用户在垃圾回收事件发生后、垃圾回收周期完成后,安排一组对 Node-API 的调用。这些函数指针可以与 node_api_post_finalizer 一起使用。

【Function pointer type for add-on provided function that allow the user to schedule a group of calls to Node-APIs in response to a garbage collection event, after the garbage collection cycle has completed. These function pointers can be used with node_api_post_finalizer.】

typedef void (*napi_finalize)(napi_env env,
                              void* finalize_data,
                              void* finalize_hint); 

变更历史:

【Change History:】

  • 实验性(定义了 NAPI_EXPERIMENTAL):

    这种类型的函数不再可用作终结器,除非使用 node_api_post_finalizer。必须使用 node_api_basic_finalize 代替。通过定义 NODE_API_EXPERIMENTAL_BASIC_ENV_OPT_OUT 可以关闭此功能。