Category : add-on

I am returning multiple object using one node addon. #include <napi.h> #include "myobject.h" #include "myobject1.h" #include "myobject2.h" #include <iostream> Napi::Object CreateObject(const Napi::CallbackInfo& info) { int num = info[0].As<Napi::Number>().Int32Value(); switch (num) { case 1: std::cout << "Object 1" << std::endl; return MyObject::NewInstance(info.Env(), info[0]); break; case 2: std::cout << "Object 2" << std::endl; return MyObject1::NewInstance(info.Env(), info[0]); break; ..

Read more