Skip to content

Sending a another wrapped object from native addon function #1146

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

Closed
jay11ca39 opened this issue Mar 9, 2018 · 4 comments
Closed

Sending a another wrapped object from native addon function #1146

jay11ca39 opened this issue Mar 9, 2018 · 4 comments

Comments

@jay11ca39
Copy link

jay11ca39 commented Mar 9, 2018

Hello All,
I am writing native addon for my CPP library.
I have 2 classes:

  class A : public Nan::ObjectWrap
    {
        public:
            static void Init(v8::Local<v8::Object> exports);
            virtual ~A();

        private:
            static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);

             ...................other methods.................

            static Nan::Persistent<v8::Function> constructor;
    };
  class B : public Nan::ObjectWrap
    {
        public:
            static void Init(v8::Local<v8::Object> exports);
            virtual ~B();

        private:
            static void New(const Nan::FunctionCallbackInfo<v8::Value>& info);
            static void GetAObj(const Nan::FunctionCallbackInfo<v8::Value>& info);
           
             ...................other methods.................

            static Nan::Persistent<v8::Function> constructor;
    };

In class B there is a method: GetAObj , in this method i want to return a Class A object to javascript and from javascript I want to use that A class object to make function call of class A.

Can anybody help me out in defining GetAObj method of class B ?

  • Node.js Version: v8.9.4
  • OS: Linux 64-bit [Ubuntu 14.04]

Thanks in advance.

mod EDIT:ofrobots:fixed formatting

@gireeshpunathil
Copy link
Member

/cc @nodejs/v8

@jay11ca39 jay11ca39 changed the title Sending a another wrapped oject from native addon function Sending a another wrapped object from native addon function Mar 21, 2018
@gireeshpunathil
Copy link
Member

@jay11ca39 - I guess your #1171 is covering this issue as well? Please confirm. If so, I will close this out. Please let me know.

@jay11ca39
Copy link
Author

@gireeshpunathil ,
Sorry for multiple issues. Quite new to NAN and nodejs addons. :)
Thanks for your support. You can close this issue.

@gireeshpunathil
Copy link
Member

closing this in favor of #1171 , cheers!

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