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

n-api: fix napi_property_descriptor documentation #20433

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,7 @@ provided by the addon:
napi_value Init(napi_env env, napi_value exports) {
napi_status status;
napi_property_descriptor desc =
{"hello", Method, 0, 0, 0, napi_default, 0};
if (status != napi_ok) return NULL;
{"hello", NULL, Method, NULL, NULL, NULL, napi_default, NULL};
status = napi_define_properties(env, exports, 1, &desc);
if (status != napi_ok) return NULL;
return exports;
Expand All @@ -957,7 +956,7 @@ To define a class so that new instances can be created (often used with
napi_value Init(napi_env env, napi_value exports) {
napi_status status;
napi_property_descriptor properties[] = {
{ "value", NULL, GetValue, SetValue, 0, napi_default, 0 },
{ "value", NULL, NULL, GetValue, SetValue, NULL, napi_default, NULL },
DECLARE_NAPI_METHOD("plusOne", PlusOne),
DECLARE_NAPI_METHOD("multiply", Multiply),
};
Expand Down Expand Up @@ -2412,8 +2411,8 @@ if (status != napi_ok) return status;

// Set the properties
napi_property_descriptor descriptors[] = {
{ "foo", NULL, 0, 0, 0, fooValue, napi_default, 0 },
{ "bar", NULL, 0, 0, 0, barValue, napi_default, 0 }
{ "foo", NULL, NULL, NULL, NULL, fooValue, napi_default, NULL },
{ "bar", NULL, NULL, NULL, NULL, barValue, napi_default, NULL }
}
status = napi_define_properties(env,
obj,
Expand Down