File indexing completed on 2026-07-28 09:16:38
0001 #ifndef SRC_NODE_API_TYPES_H_
0002 #define SRC_NODE_API_TYPES_H_
0003
0004 #include "js_native_api_types.h"
0005
0006 typedef napi_value(NAPI_CDECL* napi_addon_register_func)(napi_env env,
0007 napi_value exports);
0008
0009
0010 typedef int32_t(NAPI_CDECL* node_api_addon_get_api_version_func)(void);
0011
0012 typedef struct napi_callback_scope__* napi_callback_scope;
0013 typedef struct napi_async_context__* napi_async_context;
0014 typedef struct napi_async_work__* napi_async_work;
0015
0016 #if NAPI_VERSION >= 3
0017 typedef void(NAPI_CDECL* napi_cleanup_hook)(void* arg);
0018 #endif
0019
0020 #if NAPI_VERSION >= 4
0021 typedef struct napi_threadsafe_function__* napi_threadsafe_function;
0022 #endif
0023
0024 #if NAPI_VERSION >= 4
0025 typedef enum {
0026 napi_tsfn_release,
0027 napi_tsfn_abort
0028 } napi_threadsafe_function_release_mode;
0029
0030 typedef enum {
0031 napi_tsfn_nonblocking,
0032 napi_tsfn_blocking
0033 } napi_threadsafe_function_call_mode;
0034 #endif
0035
0036 typedef void(NAPI_CDECL* napi_async_execute_callback)(napi_env env, void* data);
0037 typedef void(NAPI_CDECL* napi_async_complete_callback)(napi_env env,
0038 napi_status status,
0039 void* data);
0040 #if NAPI_VERSION >= 4
0041 typedef void(NAPI_CDECL* napi_threadsafe_function_call_js)(
0042 napi_env env, napi_value js_callback, void* context, void* data);
0043 #endif
0044
0045 typedef struct {
0046 uint32_t major;
0047 uint32_t minor;
0048 uint32_t patch;
0049 const char* release;
0050 } napi_node_version;
0051
0052 #if NAPI_VERSION >= 8
0053 typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
0054 typedef void(NAPI_CDECL* napi_async_cleanup_hook)(
0055 napi_async_cleanup_hook_handle handle, void* data);
0056 #endif
0057
0058 #endif