@@ -2345,32 +2345,17 @@ void Initialize(Local<Object> target,
2345
2345
Local<FunctionTemplate> aiw =
2346
2346
BaseObject::MakeLazilyInitializedJSTemplate (env);
2347
2347
aiw->Inherit (AsyncWrap::GetConstructorTemplate (env));
2348
- Local<String> addrInfoWrapString =
2349
- FIXED_ONE_BYTE_STRING (env->isolate (), " GetAddrInfoReqWrap" );
2350
- aiw->SetClassName (addrInfoWrapString);
2351
- target->Set (env->context (),
2352
- addrInfoWrapString,
2353
- aiw->GetFunction (context).ToLocalChecked ()).Check ();
2348
+ env->SetConstructorFunction (target, " GetAddrInfoReqWrap" , aiw);
2354
2349
2355
2350
Local<FunctionTemplate> niw =
2356
2351
BaseObject::MakeLazilyInitializedJSTemplate (env);
2357
2352
niw->Inherit (AsyncWrap::GetConstructorTemplate (env));
2358
- Local<String> nameInfoWrapString =
2359
- FIXED_ONE_BYTE_STRING (env->isolate (), " GetNameInfoReqWrap" );
2360
- niw->SetClassName (nameInfoWrapString);
2361
- target->Set (env->context (),
2362
- nameInfoWrapString,
2363
- niw->GetFunction (context).ToLocalChecked ()).Check ();
2353
+ env->SetConstructorFunction (target, " GetNameInfoReqWrap" , niw);
2364
2354
2365
2355
Local<FunctionTemplate> qrw =
2366
2356
BaseObject::MakeLazilyInitializedJSTemplate (env);
2367
2357
qrw->Inherit (AsyncWrap::GetConstructorTemplate (env));
2368
- Local<String> queryWrapString =
2369
- FIXED_ONE_BYTE_STRING (env->isolate (), " QueryReqWrap" );
2370
- qrw->SetClassName (queryWrapString);
2371
- target->Set (env->context (),
2372
- queryWrapString,
2373
- qrw->GetFunction (context).ToLocalChecked ()).Check ();
2358
+ env->SetConstructorFunction (target, " QueryReqWrap" , qrw);
2374
2359
2375
2360
Local<FunctionTemplate> channel_wrap =
2376
2361
env->NewFunctionTemplate (ChannelWrap::New);
@@ -2397,11 +2382,7 @@ void Initialize(Local<Object> target,
2397
2382
env->SetProtoMethod (channel_wrap, " setLocalAddress" , SetLocalAddress);
2398
2383
env->SetProtoMethod (channel_wrap, " cancel" , Cancel);
2399
2384
2400
- Local<String> channelWrapString =
2401
- FIXED_ONE_BYTE_STRING (env->isolate (), " ChannelWrap" );
2402
- channel_wrap->SetClassName (channelWrapString);
2403
- target->Set (env->context (), channelWrapString,
2404
- channel_wrap->GetFunction (context).ToLocalChecked ()).Check ();
2385
+ env->SetConstructorFunction (target, " ChannelWrap" , channel_wrap);
2405
2386
}
2406
2387
2407
2388
} // anonymous namespace
0 commit comments