• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 #ifndef TEST_JS_NATIVE_API_7_FACTORY_WRAP_MYOBJECT_H_
2 #define TEST_JS_NATIVE_API_7_FACTORY_WRAP_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_value GetFinalizeCount(napi_env env, napi_callback_info info);
11   static napi_status NewInstance(napi_env env,
12                                  napi_value arg,
13                                  napi_value* instance);
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   static napi_value PlusOne(napi_env env, napi_callback_info info);
22   uint32_t counter_;
23   napi_env env_;
24   napi_ref wrapper_;
25 };
26 
27 #endif  // TEST_JS_NATIVE_API_7_FACTORY_WRAP_MYOBJECT_H_
28