Skip to content

Commit

Permalink
Update object_wrap.md (#1094)
Browse files Browse the repository at this point in the history
* Update object_wrap.md

Add the default attributes for methods to the example to make them writeable by default.

See #811 for discussion.
  • Loading branch information
alexanderfloh authored Nov 12, 2021
1 parent 5aab27e commit 7423cc5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions doc/object_wrap.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ class Example : public Napi::ObjectWrap<Example> {
Napi::Object Example::Init(Napi::Env env, Napi::Object exports) {
// This method is used to hook the accessor and method callbacks
Napi::Function func = DefineClass(env, "Example", {
InstanceMethod<&Example::GetValue>("GetValue"),
InstanceMethod<&Example::SetValue>("SetValue"),
StaticMethod<&Example::CreateNewItem>("CreateNewItem"),
InstanceMethod<&Example::GetValue>("GetValue", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
InstanceMethod<&Example::SetValue>("SetValue", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
StaticMethod<&Example::CreateNewItem>("CreateNewItem", static_cast<napi_property_attributes>(napi_writable | napi_configurable)),
});

Napi::FunctionReference* constructor = new Napi::FunctionReference();
Expand Down

0 comments on commit 7423cc5

Please sign in to comment.