diff options
Diffstat (limited to 'src/tcp_wrap.cc')
-rw-r--r-- | src/tcp_wrap.cc | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index fa45bd118d4..cd7174984e2 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -74,8 +74,6 @@ void TCPWrap::Initialize(Local<Object> target, Environment* env = Environment::GetCurrent(context); Local<FunctionTemplate> t = env->NewFunctionTemplate(New); - Local<String> tcpString = FIXED_ONE_BYTE_STRING(env->isolate(), "TCP"); - t->SetClassName(tcpString); t->InstanceTemplate()->SetInternalFieldCount(StreamBase::kInternalFieldCount); // Init properties @@ -103,21 +101,14 @@ void TCPWrap::Initialize(Local<Object> target, env->SetProtoMethod(t, "setSimultaneousAccepts", SetSimultaneousAccepts); #endif - target->Set(env->context(), - tcpString, - t->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "TCP", t); env->set_tcp_constructor_template(t); // Create FunctionTemplate for TCPConnectWrap. Local<FunctionTemplate> cwt = BaseObject::MakeLazilyInitializedJSTemplate(env); cwt->Inherit(AsyncWrap::GetConstructorTemplate(env)); - Local<String> wrapString = - FIXED_ONE_BYTE_STRING(env->isolate(), "TCPConnectWrap"); - cwt->SetClassName(wrapString); - target->Set(env->context(), - wrapString, - cwt->GetFunction(env->context()).ToLocalChecked()).Check(); + env->SetConstructorFunction(target, "TCPConnectWrap", cwt); // Define constants Local<Object> constants = Object::New(env->isolate()); |