• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef SRC_NODE_API_TYPES_H_
2 #define SRC_NODE_API_TYPES_H_
3 
4 #include "jsvm_types.h"
5 
6 typedef struct jsvm_callback_scope__* jsvm_callback_scope;
7 typedef struct jsvm_async_context__* jsvm_async_context;
8 typedef struct jsvm_async_work__* jsvm_async_work;
9 
10 #if NAPI_VERSION >= 3
11 typedef void(JSVM_CDECL* jsvm_cleanup_hook)(void* arg);
12 #endif  // NAPI_VERSION >= 3
13 
14 #if NAPI_VERSION >= 4
15 typedef struct jsvm_threadsafe_function__* jsvm_threadsafe_function;
16 #endif  // NAPI_VERSION >= 4
17 
18 #if NAPI_VERSION >= 4
19 typedef enum {
20   jsvm_tsfn_release,
21   jsvm_tsfn_abort
22 } jsvm_threadsafe_function_release_mode;
23 
24 typedef enum {
25   jsvm_tsfn_nonblocking,
26   jsvm_tsfn_blocking
27 } jsvm_threadsafe_function_call_mode;
28 #endif  // NAPI_VERSION >= 4
29 
30 typedef void(JSVM_CDECL* jsvm_async_execute_callback)(JSVM_Env env, void* data);
31 typedef void(JSVM_CDECL* jsvm_async_complete_callback)(JSVM_Env env,
32                                                        JSVM_Status status,
33                                                        void* data);
34 #if NAPI_VERSION >= 4
35 typedef void(JSVM_CDECL* jsvm_threadsafe_function_call_js)(
36     JSVM_Env env, JSVM_Value js_callback, void* context, void* data);
37 #endif  // NAPI_VERSION >= 4
38 
39 typedef struct {
40   uint32_t major;
41   uint32_t minor;
42   uint32_t patch;
43   const char* release;
44 } jsvm_node_version;
45 
46 #if NAPI_VERSION >= 8
47 typedef struct jsvm_async_cleanup_hook_handle__* jsvm_async_cleanup_hook_handle;
48 typedef void(JSVM_CDECL* jsvm_async_cleanup_hook)(
49     jsvm_async_cleanup_hook_handle handle, void* data);
50 #endif  // NAPI_VERSION >= 8
51 
52 #endif  // SRC_NODE_API_TYPES_H_
53