From 7423cc502558255864243522b3732c4664afe7c1 Mon Sep 17 00:00:00 2001 From: Alexander Floh Date: Fri, 12 Nov 2021 18:32:03 +0100 Subject: [PATCH] Update object_wrap.md (#1094) * Update object_wrap.md Add the default attributes for methods to the example to make them writeable by default. See https://github.com/nodejs/node-addon-api/issues/811 for discussion. --- doc/object_wrap.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/doc/object_wrap.md b/doc/object_wrap.md index d90da42c4..0d3ef9856 100644 --- a/doc/object_wrap.md +++ b/doc/object_wrap.md @@ -36,9 +36,9 @@ class Example : public Napi::ObjectWrap { 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_writable | napi_configurable)), + InstanceMethod<&Example::SetValue>("SetValue", static_cast(napi_writable | napi_configurable)), + StaticMethod<&Example::CreateNewItem>("CreateNewItem", static_cast(napi_writable | napi_configurable)), }); Napi::FunctionReference* constructor = new Napi::FunctionReference();