node/test/addons/hello-world/binding.cc

15 lines
369 B
C++
Raw Normal View History

2011-12-21 14:03:32 +08:00
#include <node.h>
#include <v8.h>
void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
v8::Isolate* isolate = args.GetIsolate();
v8::HandleScope scope(isolate);
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
2011-12-21 14:03:32 +08:00
}
void init(v8::Handle<v8::Object> target) {
2011-12-21 14:03:32 +08:00
NODE_SET_METHOD(target, "hello", Method);
}
NODE_MODULE(binding, init);