Created
October 25, 2017 04:59
-
-
Save ramirezd42/3c22c512e96e00db0dbd686d86fd3a37 to your computer and use it in GitHub Desktop.
ex_1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <nan.h> | |
void RunCallback(const Nan::FunctionCallbackInfo<v8::Value>& info) { | |
v8::Local<v8::Function> cb = info[0].As<v8::Function>(); | |
const unsigned argc = 1; | |
v8::Local<v8::Value> argv[argc] = { Nan::New("hello world").ToLocalChecked() }; | |
Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, argc, argv); | |
} | |
void Init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module) { | |
Nan::SetMethod(module, "exports", RunCallback); | |
} | |
NODE_MODULE(addon, Init) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment