Skip to content

Instantly share code, notes, and snippets.

@wraithan
Created November 24, 2015 16:49
Show Gist options
  • Save wraithan/0fe421e6583d92f0b9ce to your computer and use it in GitHub Desktop.
Save wraithan/0fe421e6583d92f0b9ce to your computer and use it in GitHub Desktop.
#include <nan.h>
namespace memcheck {
using v8::Function;
using v8::FunctionTemplate;
using v8::Local;
using v8::String;
using v8::Value;
using Nan::Callback;
using Nan::GetFunction;
using Nan::New;
using Nan::Set;
NAN_METHOD(GatherData) {
Callback *cb = new Callback(info[0].As<Function>());
Local<Value> argv[] = {};
cb->Call(0, argv);
}
NAN_MODULE_INIT(InitAll) {
Set(target, New<String>("gatherData").ToLocalChecked(),
GetFunction(New<FunctionTemplate>(GatherData)).ToLocalChecked());
}
NODE_MODULE(addon, InitAll)
} // namespace memcheck
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment