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

Class ObjectWrap

napi.h:2512–2662  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2510/// }
2511template <typename T>
2512class ObjectWrap : public InstanceWrap<T>, public Reference<Object> {
2513 public:
2514 ObjectWrap(const CallbackInfo& callbackInfo);
2515 virtual ~ObjectWrap();
2516
2517 static T* Unwrap(Object wrapper);
2518
2519 // Methods exposed to JavaScript must conform to one of these callback
2520 // signatures.
2521 using StaticVoidMethodCallback = void (*)(const CallbackInfo& info);
2522 using StaticMethodCallback = Napi::Value (*)(const CallbackInfo& info);
2523 using StaticGetterCallback = Napi::Value (*)(const CallbackInfo& info);
2524 using StaticSetterCallback = void (*)(const CallbackInfo& info,
2525 const Napi::Value& value);
2526
2527 using PropertyDescriptor = ClassPropertyDescriptor<T>;
2528
2529 static Function DefineClass(
2530 Napi::Env env,
2531 const char* utf8name,
2532 const std::initializer_list<PropertyDescriptor>& properties,
2533 void* data = nullptr);
2534 static Function DefineClass(Napi::Env env,
2535 const char* utf8name,
2536 const std::vector<PropertyDescriptor>& properties,
2537 void* data = nullptr);
2538 static PropertyDescriptor StaticMethod(
2539 const char* utf8name,
2540 StaticVoidMethodCallback method,
2541 napi_property_attributes attributes = napi_default,
2542 void* data = nullptr);
2543 static PropertyDescriptor StaticMethod(
2544 const char* utf8name,
2545 StaticMethodCallback method,
2546 napi_property_attributes attributes = napi_default,
2547 void* data = nullptr);
2548 static PropertyDescriptor StaticMethod(
2549 Symbol name,
2550 StaticVoidMethodCallback method,
2551 napi_property_attributes attributes = napi_default,
2552 void* data = nullptr);
2553 static PropertyDescriptor StaticMethod(
2554 Symbol name,
2555 StaticMethodCallback method,
2556 napi_property_attributes attributes = napi_default,
2557 void* data = nullptr);
2558 template <StaticVoidMethodCallback method>
2559 static PropertyDescriptor StaticMethod(
2560 const char* utf8name,
2561 napi_property_attributes attributes = napi_default,
2562 void* data = nullptr);
2563 template <StaticVoidMethodCallback method>
2564 static PropertyDescriptor StaticMethod(
2565 Symbol name,
2566 napi_property_attributes attributes = napi_default,
2567 void* data = nullptr);
2568 template <StaticMethodCallback method>
2569 static PropertyDescriptor StaticMethod(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected