mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
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:
1 parent
8e2e16721b
commit
5fa5ab6c48
1 file changed
+4
-4
+4
-4
@@ -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
|
||||
|
||||
|
||||
Reference in new issue
Block a user