@@ -1898,32 +1898,17 @@ void Initialize(Local<Object> target,
1898
1898
Local<FunctionTemplate> aiw =
1899
1899
BaseObject::MakeLazilyInitializedJSTemplate (env);
1900
1900
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);
1907
1902
1908
1903
Local<FunctionTemplate> niw =
1909
1904
BaseObject::MakeLazilyInitializedJSTemplate (env);
1910
1905
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);
1917
1907
1918
1908
Local<FunctionTemplate> qrw =
1919
1909
BaseObject::MakeLazilyInitializedJSTemplate (env);
1920
1910
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);
1927
1912
1928
1913
Local<FunctionTemplate> channel_wrap =
1929
1914
env->NewFunctionTemplate (ChannelWrap::New);
@@ -1950,11 +1935,7 @@ void Initialize(Local<Object> target,
1950
1935
env->SetProtoMethod (channel_wrap, " setLocalAddress" , SetLocalAddress);
1951
1936
env->SetProtoMethod (channel_wrap, " cancel" , Cancel);
1952
1937
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);
1958
1939
}
1959
1940
1960
1941
} // namespace cares_wrap
0 commit comments