Skip to content

Commit

Permalink
doc: added some comments to ClassPropertyDescriptor. (#1149)
Browse files Browse the repository at this point in the history
  • Loading branch information
kevindavies8 committed Mar 31, 2022
1 parent ef5b5df commit 27f4003
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions doc/class_property_descriptor.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Class property and descriptor

Property descriptor for use with `Napi::ObjectWrap::DefineClass()`.
This is different from the standalone `Napi::PropertyDescriptor` because it is
specific to each `Napi::ObjectWrap<T>` subclass.
This prevents using descriptors from a different class when defining a new class
(preventing the callbacks from having incorrect `this` pointers).
Property descriptor for use with `Napi::ObjectWrap<T>` and
`Napi::InstanceWrap<T>`. This is different from the standalone
`Napi::PropertyDescriptor` because it is specific to each
`Napi::ObjectWrap<T>` and `Napi::InstanceWrap<T>` subclasses.
This prevents using descriptors from a different class when defining a new
class (preventing the callbacks from having incorrect `this` pointers).

`Napi::ClassPropertyDescriptor` is a helper class created with
`Napi::ObjectWrap<T>` and `Napi::InstanceWrap<T>`. For more reference about it
see:

- [InstanceWrap](./instance_wrap.md)
- [ObjectWrap](./object_wrap.md)

## Example

Expand Down

0 comments on commit 27f4003

Please sign in to comment.