Skip to content

Commit

Permalink
doc: naming function as suggested in addon docs
Browse files Browse the repository at this point in the history
PR-URL: #21067
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Trivikram Kamat <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
allevo authored and targos committed Jun 13, 2018
1 parent 8e2e167 commit 5fa5ab6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions doc/api/addons.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ void Method(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
}

void init(Local<Object> exports) {
void Initialize(Local<Object> exports) {
NODE_SET_METHOD(exports, "hello", Method);
}

NODE_MODULE(NODE_GYP_MODULE_NAME, init)
NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)

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

In the `hello.cc` example, then, the initialization function is `init` and the
Addon module name is `addon`.
In the `hello.cc` example, then, the initialization function is `Initialize`
and the addon module name is `addon`.

### Building

Expand Down

0 comments on commit 5fa5ab6

Please sign in to comment.