diff options
author | Tommaso Allevi <tomallevi@gmail.com> | 2018-05-31 22:49:38 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-06-08 01:06:49 +0200 |
commit | a8e57751954d8a2ebb2369e56c68cb70903b4c11 (patch) | |
tree | f4e79470eeb6d53284834373398e828599f53444 /doc | |
parent | a76f0298184115971bac56dd369418786569f76d (diff) | |
download | android-node-v8-a8e57751954d8a2ebb2369e56c68cb70903b4c11.tar.gz android-node-v8-a8e57751954d8a2ebb2369e56c68cb70903b4c11.tar.bz2 android-node-v8-a8e57751954d8a2ebb2369e56c68cb70903b4c11.zip |
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>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/api/addons.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/doc/api/addons.md b/doc/api/addons.md index a0e16cff35..578b1a0f90 100644 --- a/doc/api/addons.md +++ b/doc/api/addons.md @@ -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 ``` @@ -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 |