1 #ifndef TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_ 2 #define TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_ 3 4 #include <js_native_api.h> 5 6 class MyObject { 7 public: 8 static napi_status Init(napi_env env); 9 static void Destructor(napi_env env, void* nativeObject, void* finalize_hint); 10 static napi_status NewInstance(napi_env env, 11 napi_value arg, 12 napi_value* instance); Val()13 double Val() const { return val_; } 14 15 private: 16 MyObject(); 17 ~MyObject(); 18 19 static napi_ref constructor; 20 static napi_value New(napi_env env, napi_callback_info info); 21 double val_; 22 napi_env env_; 23 napi_ref wrapper_; 24 }; 25 26 #endif // TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_ 27