node/benchmark/misc/function_call/binding.cc

18 lines
331 B
C++

#include <v8.h>
#include <node.h>
using namespace v8;
static int c = 0;
void Hello(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(c++);
}
extern "C" void init (Handle<Object> target) {
HandleScope scope(Isolate::GetCurrent());
NODE_SET_METHOD(target, "hello", Hello);
}
NODE_MODULE(binding, init);