• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SRC_NODE_API_TYPES_H_
2 #define SRC_NODE_API_TYPES_H_
3 
4 #include "js_native_api_types.h"
5 
6 typedef struct napi_callback_scope__* napi_callback_scope;
7 typedef struct napi_async_context__* napi_async_context;
8 typedef struct napi_async_work__* napi_async_work;
9 #if NAPI_VERSION >= 4
10 typedef struct napi_threadsafe_function__* napi_threadsafe_function;
11 #endif  // NAPI_VERSION >= 4
12 
13 #if NAPI_VERSION >= 4
14 typedef enum {
15   napi_tsfn_release,
16   napi_tsfn_abort
17 } napi_threadsafe_function_release_mode;
18 
19 typedef enum {
20   napi_tsfn_nonblocking,
21   napi_tsfn_blocking
22 } napi_threadsafe_function_call_mode;
23 #endif  // NAPI_VERSION >= 4
24 
25 typedef void (*napi_async_execute_callback)(napi_env env,
26                                             void* data);
27 typedef void (*napi_async_complete_callback)(napi_env env,
28                                              napi_status status,
29                                              void* data);
30 #if NAPI_VERSION >= 4
31 typedef void (*napi_threadsafe_function_call_js)(napi_env env,
32                                                  napi_value js_callback,
33                                                  void* context,
34                                                  void* data);
35 #endif  // NAPI_VERSION >= 4
36 
37 typedef struct {
38   uint32_t major;
39   uint32_t minor;
40   uint32_t patch;
41   const char* release;
42 } napi_node_version;
43 
44 #if NAPI_VERSION >= 8
45 typedef struct napi_async_cleanup_hook_handle__* napi_async_cleanup_hook_handle;
46 typedef void (*napi_async_cleanup_hook)(napi_async_cleanup_hook_handle handle,
47                                         void* data);
48 #endif  // NAPI_VERSION >= 8
49 
50 #endif  // SRC_NODE_API_TYPES_H_
51