summaryrefslogtreecommitdiff
path: root/platform/node/src/node_request.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'platform/node/src/node_request.cpp')
-rw-r--r--platform/node/src/node_request.cpp9
1 files changed, 2 insertions, 7 deletions
diff --git a/platform/node/src/node_request.cpp b/platform/node/src/node_request.cpp
index d7931ac572..252279a592 100644
--- a/platform/node/src/node_request.cpp
+++ b/platform/node/src/node_request.cpp
@@ -26,14 +26,13 @@ NodeRequest::~NodeRequest() {
Nan::Persistent<v8::Function> NodeRequest::constructor;
-NAN_MODULE_INIT(NodeRequest::Init) {
+void NodeRequest::Init() {
v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
tpl->InstanceTemplate()->SetInternalFieldCount(1);
tpl->SetClassName(Nan::New("Request").ToLocalChecked());
constructor.Reset(tpl->GetFunction());
- Nan::Set(target, Nan::New("Request").ToLocalChecked(), tpl->GetFunction());
}
void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) {
@@ -47,16 +46,12 @@ void NodeRequest::New(const Nan::FunctionCallbackInfo<v8::Value>& info) {
}
void NodeRequest::Execute() {
- Nan::HandleScope handleScope;
-
// Enter a new v8::Context to avoid leaking v8::FunctionTemplate
// from Nan::New<v8::Function>
v8::Local<v8::Context> context = v8::Context::New(v8::Isolate::GetCurrent());
v8::Context::Scope scope(context);
- auto fn = Nan::New<v8::Function>(NodeRequest::Respond, handle());
-
- v8::Local<v8::Value> argv[] = { handle(), fn };
+ v8::Local<v8::Value> argv[] = { handle(), Nan::New<v8::Function>(NodeRequest::Respond, handle()) };
Nan::MakeCallback(Nan::To<v8::Object>(target->handle()->GetInternalField(1)).ToLocalChecked(), "request", 2, argv);
}