Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nan conversion of external type #95

Open
imrehg opened this issue May 2, 2019 · 2 comments
Open

Nan conversion of external type #95

imrehg opened this issue May 2, 2019 · 2 comments

Comments

@imrehg
Copy link

imrehg commented May 2, 2019

Have a piece of code, that works on node <12, but will need to be converted to for node 12.

return static_cast<ext2_filsys>(
  info[0]->ToObject().As<v8::External>()->Value()
);

I couldn't see any examples for v8::External in conversion (i.e. I'm guessing using it with Nan::To<v8::Object>?)

What would be an example of using such v8::External cases?

@imrehg
Copy link
Author

imrehg commented May 2, 2019

Resolved it with this form, but feels like I might be mixing stuff here quote a bit.

return static_cast<ext2_filsys>(
   Nan::To<v8::Object>(info[0]).ToLocalChecked().As<v8::External>()->Value()
);

@mhdawson
Copy link
Member

mhdawson commented May 9, 2019

@imrehg we are mostly maintaining the napi/node-addon-api examples. Sounds like you may have already answered your own question anyway.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants