Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5fa5ab6

Browse filesBrowse files
allevotargos
authored andcommitted
doc: naming function as suggested in addon docs
PR-URL: #21067 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 8e2e167 commit 5fa5ab6
Copy full SHA for 5fa5ab6

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎doc/api/addons.md‎

Copy file name to clipboardExpand all lines: doc/api/addons.md
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ void Method(const FunctionCallbackInfo<Value>& args) {
7272
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
7373
}
7474

75-
void init(Local<Object> exports) {
75+
void Initialize(Local<Object> exports) {
7676
NODE_SET_METHOD(exports, "hello", Method);
7777
}
7878

79-
NODE_MODULE(NODE_GYP_MODULE_NAME, init)
79+
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
8080

8181
} // namespace demo
8282
```
@@ -95,8 +95,8 @@ There is no semi-colon after `NODE_MODULE` as it's not a function (see
9595
The `module_name` must match the filename of the final binary (excluding
9696
the `.node` suffix).
9797

98-
In the `hello.cc` example, then, the initialization function is `init` and the
99-
Addon module name is `addon`.
98+
In the `hello.cc` example, then, the initialization function is `Initialize`
99+
and the addon module name is `addon`.
100100

101101
### Building
102102

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.