File tree Expand file tree Collapse file tree 2 files changed +448
-17
lines changed Expand file tree Collapse file tree 2 files changed +448
-17
lines changed Original file line number Diff line number Diff line change 1
- # Class propertry and descriptior
1
+ # Class propertry and descriptor
2
2
3
- You are reading a draft of the next documentation and it's in continuous update so
4
- if you don't find what you need please refer to:
5
- [ C++ wrapper classes for the ABI-stable C APIs for Node.js] ( https://nodejs.github.io/node-addon-api/ )
3
+ Property descriptor for use with ` Napi::ObjectWrap::DefineClass() ` .
4
+ This is different from the standalone ` Napi::PropertyDescriptor ` because it is
5
+ specific to each ` Napi::ObjectWrap<T> ` subclass.
6
+ This prevents using descriptors from a different class when defining a new class
7
+ (preventing the callbacks from having incorrect ` this ` pointers).
8
+
9
+ ## Methods
10
+
11
+ ### Contructor
12
+
13
+ Creates new instance of ` Napi::ClassPropertyDescriptor ` descriptor object.
14
+
15
+ ``` cpp
16
+ Napi::ClassPropertyDescriptor (napi_property_descriptor desc) : _ desc(desc) {}
17
+ ```
18
+
19
+ - `[in] desc`: The `napi_property_descriptor`
20
+
21
+ Returns new instance of `Napi::ClassPropertyDescriptor` that is used as property descriptor
22
+ inside the `Napi::ObjectWrap<T>` class.
23
+
24
+ ### Operator
25
+
26
+ ```cpp
27
+ operator napi_property_descriptor&() { return _desc; }
28
+ ```
29
+
30
+ Returns the original N-API ` napi_property_descriptor ` wrapped inside the ` Napi::ClassPropertyDescriptor `
31
+
32
+ ``` cpp
33
+ operator const napi_property_descriptor&() const { return _ desc; }
34
+ ```
35
+
36
+ Returns the original N-API `napi_property_descriptor` wrapped inside the `Napi::ClassPropertyDescriptor`
You can’t perform that action at this time.
0 commit comments