Skip to content

Instantly share code, notes, and snippets.

@sagivo
Created September 30, 2015 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sagivo/7cac5c7a7bec393a5c37 to your computer and use it in GitHub Desktop.
Save sagivo/7cac5c7a7bec393a5c37 to your computer and use it in GitHub Desktop.
#include <node.h>
namespace demo {
using v8::FunctionCallbackInfo;
using v8::Isolate;
using v8::Local;
using v8::Object;
using v8::String;
using v8::Value;
void Method(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
}
void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "hello", Method);
}
NODE_MODULE(addon, init)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment