@@ -1898,32 +1898,17 @@ void Initialize(Local<Object> target,
18981898 Local<FunctionTemplate> aiw =
18991899 BaseObject::MakeLazilyInitializedJSTemplate (env);
19001900 aiw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1901- Local<String> addrInfoWrapString =
1902- FIXED_ONE_BYTE_STRING (env->isolate (), " GetAddrInfoReqWrap" );
1903- aiw->SetClassName (addrInfoWrapString);
1904- target->Set (env->context (),
1905- addrInfoWrapString,
1906- aiw->GetFunction (context).ToLocalChecked ()).Check ();
1901+ env->SetConstructorFunction (target, " GetAddrInfoReqWrap" , aiw);
19071902
19081903 Local<FunctionTemplate> niw =
19091904 BaseObject::MakeLazilyInitializedJSTemplate (env);
19101905 niw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1911- Local<String> nameInfoWrapString =
1912- FIXED_ONE_BYTE_STRING (env->isolate (), " GetNameInfoReqWrap" );
1913- niw->SetClassName (nameInfoWrapString);
1914- target->Set (env->context (),
1915- nameInfoWrapString,
1916- niw->GetFunction (context).ToLocalChecked ()).Check ();
1906+ env->SetConstructorFunction (target, " GetNameInfoReqWrap" , niw);
19171907
19181908 Local<FunctionTemplate> qrw =
19191909 BaseObject::MakeLazilyInitializedJSTemplate (env);
19201910 qrw->Inherit (AsyncWrap::GetConstructorTemplate (env));
1921- Local<String> queryWrapString =
1922- FIXED_ONE_BYTE_STRING (env->isolate (), " QueryReqWrap" );
1923- qrw->SetClassName (queryWrapString);
1924- target->Set (env->context (),
1925- queryWrapString,
1926- qrw->GetFunction (context).ToLocalChecked ()).Check ();
1911+ env->SetConstructorFunction (target, " QueryReqWrap" , qrw);
19271912
19281913 Local<FunctionTemplate> channel_wrap =
19291914 env->NewFunctionTemplate (ChannelWrap::New);
@@ -1950,11 +1935,7 @@ void Initialize(Local<Object> target,
19501935 env->SetProtoMethod (channel_wrap, " setLocalAddress" , SetLocalAddress);
19511936 env->SetProtoMethod (channel_wrap, " cancel" , Cancel);
19521937
1953- Local<String> channelWrapString =
1954- FIXED_ONE_BYTE_STRING (env->isolate (), " ChannelWrap" );
1955- channel_wrap->SetClassName (channelWrapString);
1956- target->Set (env->context (), channelWrapString,
1957- channel_wrap->GetFunction (context).ToLocalChecked ()).Check ();
1938+ env->SetConstructorFunction (target, " ChannelWrap" , channel_wrap);
19581939}
19591940
19601941} // namespace cares_wrap
0 commit comments