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 {
125125 Hint* hint;
126126};
127127
128+ #if (NAPI_VERSION > 3)
128129template <typename ContextType=void ,
129130 typename Finalizer=std::function<void (Env, void *, ContextType*)>,
130131 typename FinalizerDataType=void >
@@ -196,6 +197,7 @@ struct ThreadSafeFinalize {
196197 Finalizer callback;
197198 napi_threadsafe_function* tsfn;
198199};
200+ #endif
199201
200202template <typename Getter, typename Setter>
201203struct AccessorCallbackData {
@@ -3740,6 +3742,7 @@ inline void AsyncWorker::OnWorkComplete(
37403742 }
37413743}
37423744
3745+ #if (NAPI_VERSION > 3)
37433746// //////////////////////////////////////////////////////////////////////////////
37443747// ThreadSafeFunction class
37453748// //////////////////////////////////////////////////////////////////////////////
@@ -4058,6 +4061,7 @@ inline void ThreadSafeFunction::CallJS(napi_env env,
40584061 Function (env, jsCallback).Call ({});
40594062 }
40604063}
4064+ #endif
40614065
40624066// //////////////////////////////////////////////////////////////////////////////
40634067// Memory Management class
Original file line number Diff line number Diff line change @@ -1830,6 +1830,7 @@ namespace Napi {
18301830 bool _suppress_destruct;
18311831 };
18321832
1833+ #if (NAPI_VERSION > 3)
18331834 class ThreadSafeFunction {
18341835 public:
18351836 // This API may only be called from the main thread.
@@ -2029,6 +2030,7 @@ namespace Napi {
20292030
20302031 std::unique_ptr<napi_threadsafe_function> _tsfn;
20312032 };
2033+ #endif
20322034
20332035 // Memory management.
20342036 class MemoryManagement {
Original file line number Diff line number Diff line change @@ -62,6 +62,11 @@ if ((process.env.npm_config_NAPI_VERSION !== undefined) &&
6262 testModules . splice ( testModules . indexOf ( 'version_management' ) , 1 ) ;
6363}
6464
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+
6570if ( typeof global . gc === 'function' ) {
6671 console . log ( 'Starting test suite\n' ) ;
6772
You can’t perform that action at this time.
0 commit comments