Skip to content

Commit ec00714

Browse files
committed
fixup
1 parent 4d6f2ec commit ec00714

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

3_callbacks/node_4.x/addon.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ void RunCallback(const FunctionCallbackInfo<Value>& args) {
66
Isolate* isolate = args.GetIsolate();
77

88
if (!args[0]->IsFunction()) {
9-
return args.GetReturnValue().SetUndefined();
9+
return;
1010
}
1111

1212
Local<Function> cb = Local<Function>::Cast(args[0]);

7_factory_wrap/node_4.x/addon.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ void CreateObject(const FunctionCallbackInfo<Value>& args) {
88
}
99

1010
void InitAll(Handle<Object> exports, Handle<Object> module) {
11-
MyObject::Init();
11+
MyObject::Init(exports->GetIsolate());
1212

1313
NODE_SET_METHOD(module, "exports", CreateObject);
1414
}

7_factory_wrap/node_4.x/myobject.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,11 @@ MyObject::MyObject(double value) : value_(value) {
1111
MyObject::~MyObject() {
1212
}
1313

14-
void MyObject::Init() {
15-
Isolate* isolate = Isolate::GetCurrent();
14+
void MyObject::Init(Isolate* isolate) {
1615
// Prepare constructor template
1716
Local<FunctionTemplate> tpl = FunctionTemplate::New(isolate, New);
18-
tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
1917
tpl->InstanceTemplate()->SetInternalFieldCount(1);
18+
tpl->SetClassName(String::NewFromUtf8(isolate, "MyObject"));
2019

2120
// Prototype
2221
NODE_SET_PROTOTYPE_METHOD(tpl, "plusOne", PlusOne);

7_factory_wrap/node_4.x/myobject.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
class MyObject : public node::ObjectWrap {
88
public:
9-
static void Init();
9+
static void Init(v8::Isolate* isolate);
1010
static void NewInstance(const v8::FunctionCallbackInfo<v8::Value>& args);
1111

1212
private:

0 commit comments

Comments
 (0)