GeezerVison is showing github.com — doc: naming function as suggested in addon docs · nodejs/node@5fa5ab6
File tree
Expand file treeCollapse file tree
Open diff view settings
Expand file treeCollapse file tree
Open diff view settings
Collapse file
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 number | Diff line number | Diff line change |
|---|
@@ -72,11 +72,11 @@ void Method(const FunctionCallbackInfo<Value>& args) { |
72 | 72 | args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world")); |
73 | 73 | } |
74 | 74 |
|
75 | | -void init(Local<Object> exports) { |
| 75 | +void Initialize(Local<Object> exports) { |
76 | 76 | NODE_SET_METHOD(exports, "hello", Method); |
77 | 77 | } |
78 | 78 |
|
79 | | -NODE_MODULE(NODE_GYP_MODULE_NAME, init) |
| 79 | +NODE_MODULE(NODE_GYP_MODULE_NAME, Initialize) |
80 | 80 |
|
81 | 81 | } // namespace demo |
82 | 82 | ``` |
@@ -95,8 +95,8 @@ There is no semi-colon after `NODE_MODULE` as it's not a function (see |
95 | 95 | The `module_name` must match the filename of the final binary (excluding |
96 | 96 | the `.node` suffix). |
97 | 97 |
|
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`. |
100 | 100 |
|
101 | 101 | ### Building |
102 | 102 |
|
|