From ad7ff92c16a1730675b780adea33e79570251fea Mon Sep 17 00:00:00 2001 From: Jack <32422811+JckXia@users.noreply.github.com> Date: Mon, 12 Dec 2022 12:04:57 -0500 Subject: [PATCH] src: refactor call js wrapper (#1242) * src: Refactor CallJsWrapper to workaround vs-17 --- napi-inl.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/napi-inl.h b/napi-inl.h index 90ce3a2da..e0765815c 100644 --- a/napi-inl.h +++ b/napi-inl.h @@ -255,8 +255,8 @@ struct ThreadSafeFinalize { }; template -typename std::enable_if::type static inline CallJsWrapper( - napi_env env, napi_value jsCallback, void* context, void* data) { +inline typename std::enable_if(nullptr)>::type +CallJsWrapper(napi_env env, napi_value jsCallback, void* context, void* data) { call(env, Function(env, jsCallback), static_cast(context), @@ -264,8 +264,11 @@ typename std::enable_if::type static inline CallJsWrapper( } template -typename std::enable_if::type static inline CallJsWrapper( - napi_env env, napi_value jsCallback, void* /*context*/, void* /*data*/) { +inline typename std::enable_if(nullptr)>::type +CallJsWrapper(napi_env env, + napi_value jsCallback, + void* /*context*/, + void* /*data*/) { if (jsCallback != nullptr) { Function(env, jsCallback).Call(0, nullptr); }