Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: added some comments to ClassPropertyDescriptor. #1149

Merged
merged 1 commit into from Mar 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions doc/class_property_descriptor.md
@@ -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