diff --git a/binding.gyp b/binding.gyp index 471c26c..e2cbf07 100644 --- a/binding.gyp +++ b/binding.gyp @@ -1,11 +1,20 @@ { "targets": [{ "target_name": "deasync", + "cflags!": [ "-fno-exceptions" ], + "cflags_cc!": [ "-fno-exceptions" ], + "xcode_settings": { "GCC_ENABLE_CPP_EXCEPTIONS": "YES", + "CLANG_CXX_LIBRARY": "libc++", + "MACOSX_DEPLOYMENT_TARGET": "10.7", + }, + "msvs_settings": { + "VCCLCompilerTool": { "ExceptionHandling": 1 }, + }, "sources": [ "src/deasync.cc" ], "include_dirs": [ - " #include -#include +#include +#include -using namespace v8; +using namespace Napi; -NAN_METHOD(Run) { - Nan::HandleScope scope; +Napi::Value Run(const Napi::CallbackInfo& info) { + Napi::Env env = info.Env(); + Napi::HandleScope scope(env); uv_run(uv_default_loop(), UV_RUN_ONCE); - info.GetReturnValue().Set(Nan::Undefined()); + return env.Undefined(); } -static NAN_MODULE_INIT(init) { - Nan::Set(target, Nan::New("run").ToLocalChecked(), Nan::GetFunction(Nan::New(Run)).ToLocalChecked()); +static Napi::Object init(Napi::Env env, Napi::Object exports) { + exports.Set(Napi::String::New(env, "run"), Napi::Function::New(env, Run)); + return exports; } -NODE_MODULE(deasync, init) +NODE_API_MODULE(deasync, init)