File tree Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Expand file tree Collapse file tree 3 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,7 @@ struct FinalizeData {
125
125
Hint* hint;
126
126
};
127
127
128
+ #if (NAPI_VERSION > 3)
128
129
template <typename ContextType=void ,
129
130
typename Finalizer=std::function<void (Env, void *, ContextType*)>,
130
131
typename FinalizerDataType=void >
@@ -196,6 +197,7 @@ struct ThreadSafeFinalize {
196
197
Finalizer callback;
197
198
napi_threadsafe_function* tsfn;
198
199
};
200
+ #endif
199
201
200
202
template <typename Getter, typename Setter>
201
203
struct AccessorCallbackData {
@@ -3740,6 +3742,7 @@ inline void AsyncWorker::OnWorkComplete(
3740
3742
}
3741
3743
}
3742
3744
3745
+ #if (NAPI_VERSION > 3)
3743
3746
// //////////////////////////////////////////////////////////////////////////////
3744
3747
// ThreadSafeFunction class
3745
3748
// //////////////////////////////////////////////////////////////////////////////
@@ -4058,6 +4061,7 @@ inline void ThreadSafeFunction::CallJS(napi_env env,
4058
4061
Function (env, jsCallback).Call ({});
4059
4062
}
4060
4063
}
4064
+ #endif
4061
4065
4062
4066
// //////////////////////////////////////////////////////////////////////////////
4063
4067
// Memory Management class
Original file line number Diff line number Diff line change @@ -1830,6 +1830,7 @@ namespace Napi {
1830
1830
bool _suppress_destruct;
1831
1831
};
1832
1832
1833
+ #if (NAPI_VERSION > 3)
1833
1834
class ThreadSafeFunction {
1834
1835
public:
1835
1836
// This API may only be called from the main thread.
@@ -2029,6 +2030,7 @@ namespace Napi {
2029
2030
2030
2031
std::unique_ptr<napi_threadsafe_function> _tsfn;
2031
2032
};
2033
+ #endif
2032
2034
2033
2035
// Memory management.
2034
2036
class MemoryManagement {
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ if ((process.env.npm_config_NAPI_VERSION !== undefined) &&
62
62
testModules . splice ( testModules . indexOf ( 'version_management' ) , 1 ) ;
63
63
}
64
64
65
+ if ( ( process . env . npm_config_NAPI_VERSION !== undefined ) &&
66
+ ( process . env . npm_config_NAPI_VERSION < 4 ) ) {
67
+ testModules . splice ( testModules . indexOf ( 'threadsafe_function/threadsafe_function' ) , 1 ) ;
68
+ }
69
+
65
70
if ( typeof global . gc === 'function' ) {
66
71
console . log ( 'Starting test suite\n' ) ;
67
72
You can’t perform that action at this time.
0 commit comments