MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / PropDescBenchmark

Class PropDescBenchmark

benchmark/property_descriptor.cc:30–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

28
29#if NAPI_VERSION > 5
30class PropDescBenchmark : public Napi::Addon<PropDescBenchmark> {
31 public:
32 PropDescBenchmark(Napi::Env, Napi::Object exports) {
33 DefineAddon(exports,
34 {
35 InstanceAccessor("addon",
36 &PropDescBenchmark::Getter,
37 &PropDescBenchmark::Setter,
38 napi_enumerable),
39 InstanceAccessor<&PropDescBenchmark::Getter,
40 &PropDescBenchmark::Setter>(
41 "addon_templated", napi_enumerable),
42 });
43 }
44
45 private:
46 Napi::Value Getter(const Napi::CallbackInfo& info) {
47 return Napi::Number::New(info.Env(), 42);
48 }
49
50 void Setter(const Napi::CallbackInfo& info, const Napi::Value& val) {
51 (void)info[0];
52 (void)val;
53 }
54};
55#endif // NAPI_VERSION > 5
56
57static Napi::Object Init(Napi::Env env, Napi::Object exports) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected