node/test/js-native-api/8_passing_wrapped/myobject.h
Gabriel Schulhof 938e11882b test: partition N-API tests
Partition test/addons-napi into test/js-native-api and test/node-api to
isolate the Node.js-agnostic portion of the N-API tests from the
Node.js-specific portion.

PR-URL: https://github.com/nodejs/node/pull/24557
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
2018-12-04 13:58:17 -08:00

27 lines
734 B
C++

#ifndef TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_
#define TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_
#include <js_native_api.h>
class MyObject {
public:
static napi_status Init(napi_env env);
static void Destructor(napi_env env, void* nativeObject, void* finalize_hint);
static napi_status NewInstance(napi_env env,
napi_value arg,
napi_value* instance);
double Val() const { return val_; }
private:
MyObject();
~MyObject();
static napi_ref constructor;
static napi_value New(napi_env env, napi_callback_info info);
double val_;
napi_env env_;
napi_ref wrapper_;
};
#endif // TEST_JS_NATIVE_API_8_PASSING_WRAPPED_MYOBJECT_H_