doc: naming function as suggested in addon docs

PR-URL: https://github.com/nodejs/node/pull/21067
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Tommaso Allevi 2018-05-31 22:49:38 +02:00 committed by Anna Henningsen
parent a76f029818
commit a8e5775195
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -72,11 +72,11 @@ void Method(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
} }
void init(Local<Object> exports) { void Initialize(Local<Object> exports) {
NODE_SET_METHOD(exports, "hello", Method); NODE_SET_METHOD(exports, "hello", Method);
} }
NODE_MODULE(NODE_GYP_MODULE_NAME, init) NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize)
} // namespace demo } // namespace demo
``` ```
@ -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 `module_name` must match the filename of the final binary (excluding
the `.node` suffix). the `.node` suffix).
In the `hello.cc` example, then, the initialization function is `init` and the In the `hello.cc` example, then, the initialization function is `Initialize`
Addon module name is `addon`. and the addon module name is `addon`.
### Building ### Building