args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
}
- void init(Handle<Object> exports) {
+ void init(Local<Object> exports) {
NODE_SET_METHOD(exports, "hello", Method);
}
Note that all io.js addons must export an initialization function:
- void Initialize (Handle<Object> exports);
+ void Initialize(Local<Object> exports);
NODE_MODULE(module_name, Initialize)
There is no semi-colon after `NODE_MODULE` as it's not a function (see
args.GetReturnValue().Set(num);
}
- void Init(Handle<Object> exports) {
+ void Init(Local<Object> exports) {
NODE_SET_METHOD(exports, "add", Add);
}
cb->Call(isolate->GetCurrentContext()->Global(), argc, argv);
}
- void Init(Handle<Object> exports, Handle<Object> module) {
+ void Init(Local<Object> exports, Local<Object> module) {
NODE_SET_METHOD(module, "exports", RunCallback);
}
args.GetReturnValue().Set(obj);
}
- void Init(Handle<Object> exports, Handle<Object> module) {
+ void Init(Local<Object> exports, Local<Object> module) {
NODE_SET_METHOD(module, "exports", CreateObject);
}
args.GetReturnValue().Set(fn);
}
- void Init(Handle<Object> exports, Handle<Object> module) {
+ void Init(Local<Object> exports, Local<Object> module) {
NODE_SET_METHOD(module, "exports", CreateFunction);
}
using namespace v8;
- void InitAll(Handle<Object> exports) {
+ void InitAll(Local<Object> exports) {
MyObject::Init(exports);
}
class MyObject : public node::ObjectWrap {
public:
- static void Init(v8::Handle<v8::Object> exports);
+ static void Init(v8::Local<v8::Object> exports);
private:
explicit MyObject(double value = 0);
MyObject::~MyObject() {
}
- void MyObject::Init(Handle<Object> exports) {
+ void MyObject::Init(Local<Object> exports) {
Isolate* isolate = exports->GetIsolate();
// Prepare constructor template
MyObject::NewInstance(args);
}
- void InitAll(Handle<Object> exports, Handle<Object> module) {
+ void InitAll(Local<Object> exports, Local<Object> module) {
MyObject::Init(exports->GetIsolate());
NODE_SET_METHOD(module, "exports", CreateObject);
Isolate* isolate = args.GetIsolate();
const unsigned argc = 1;
- Handle<Value> argv[argc] = { args[0] };
+ Local<Value> argv[argc] = { args[0] };
Local<Function> cons = Local<Function>::New(isolate, constructor);
Local<Object> instance = cons->NewInstance(argc, argv);
args.GetReturnValue().Set(Number::New(isolate, sum));
}
- void InitAll(Handle<Object> exports) {
+ void InitAll(Local<Object> exports) {
MyObject::Init(exports->GetIsolate());
NODE_SET_METHOD(exports, "createObject", CreateObject);
Isolate* isolate = args.GetIsolate();
const unsigned argc = 1;
- Handle<Value> argv[argc] = { args[0] };
+ Local<Value> argv[argc] = { args[0] };
Local<Function> cons = Local<Function>::New(isolate, constructor);
Local<Object> instance = cons->NewInstance(argc, argv);