2010-09-24 10:55:26 +08:00
|
|
|
#include <v8.h>
|
|
|
|
#include <node.h>
|
|
|
|
|
|
|
|
using namespace v8;
|
|
|
|
|
2010-09-24 17:21:17 +08:00
|
|
|
static int c = 0;
|
|
|
|
|
2013-08-02 06:02:38 +08:00
|
|
|
void Hello(const FunctionCallbackInfo<Value>& args) {
|
|
|
|
args.GetReturnValue().Set(c++);
|
2010-09-24 10:55:26 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
extern "C" void init (Handle<Object> target) {
|
2013-08-02 06:02:38 +08:00
|
|
|
HandleScope scope(Isolate::GetCurrent());
|
2010-09-24 10:55:26 +08:00
|
|
|
NODE_SET_METHOD(target, "hello", Hello);
|
|
|
|
}
|
2013-02-12 10:22:43 +08:00
|
|
|
|
|
|
|
NODE_MODULE(binding, init);
|