File tree Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Expand file tree Collapse file tree 4 files changed +5
-6
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ void RunCallback(const FunctionCallbackInfo<Value>& args) {
6
6
Isolate* isolate = args.GetIsolate ();
7
7
8
8
if (!args[0 ]->IsFunction ()) {
9
- return args. GetReturnValue (). SetUndefined () ;
9
+ return ;
10
10
}
11
11
12
12
Local<Function> cb = Local<Function>::Cast (args[0 ]);
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ void CreateObject(const FunctionCallbackInfo<Value>& args) {
8
8
}
9
9
10
10
void InitAll (Handle<Object> exports, Handle<Object> module ) {
11
- MyObject::Init ();
11
+ MyObject::Init (exports-> GetIsolate () );
12
12
13
13
NODE_SET_METHOD (module , " exports" , CreateObject);
14
14
}
Original file line number Diff line number Diff line change @@ -11,12 +11,11 @@ MyObject::MyObject(double value) : value_(value) {
11
11
MyObject::~MyObject () {
12
12
}
13
13
14
- void MyObject::Init () {
15
- Isolate* isolate = Isolate::GetCurrent ();
14
+ void MyObject::Init (Isolate* isolate) {
16
15
// Prepare constructor template
17
16
Local<FunctionTemplate> tpl = FunctionTemplate::New (isolate, New);
18
- tpl->SetClassName (String::NewFromUtf8 (isolate, " MyObject" ));
19
17
tpl->InstanceTemplate ()->SetInternalFieldCount (1 );
18
+ tpl->SetClassName (String::NewFromUtf8 (isolate, " MyObject" ));
20
19
21
20
// Prototype
22
21
NODE_SET_PROTOTYPE_METHOD (tpl, " plusOne" , PlusOne);
Original file line number Diff line number Diff line change 6
6
7
7
class MyObject : public node ::ObjectWrap {
8
8
public:
9
- static void Init ();
9
+ static void Init (v8::Isolate* isolate );
10
10
static void NewInstance (const v8::FunctionCallbackInfo<v8::Value>& args);
11
11
12
12
private:
You can’t perform that action at this time.
0 commit comments