-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Make it build on node v12.2.0 #81
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, it is ok, but a lot of code that is not cross-platform in terms of V8.
You must use Nan to cover differences in API between different versions of V8.
@@ -7,26 +7,54 @@ | |||
using namespace v8; | |||
|
|||
void init(Local<Object> exports) { | |||
v8::Isolate* isolate = v8::Isolate::GetCurrent(); | |||
v8::Local<v8::Context> context = isolate->GetCurrentContext(); | |||
v8::HandleScope handle_scope(isolate); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nan
has a helper for these purposes Nan::GetCurrentContext
Nan::New<FunctionTemplate>(verify)->GetFunction()); | ||
{ | ||
v8::Local<v8::Function> method; | ||
Nan::New<FunctionTemplate>(verify)->GetFunction(context).ToLocal<v8::Function>(&method); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ToLocal
does not check if monad is empty or not. Better to useToLocalChecked()
- It is a little bit stinky, to use lexical scopes for each set.
std::string cert_path = *String::Utf8Value(info[0]->ToString()); | ||
std::string ca_bundlestr = *String::Utf8Value(info[1]->ToString()); | ||
std::string cert_path = *String::Utf8Value(isolate, info[0]->ToString(isolate)); | ||
std::string ca_bundlestr = *String::Utf8Value(isolate, info[1]->ToString(isolate)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can get V8 Isolate by Nan::GetCurrentContext()->GetIsolate()
No description provided.