GeezerVison is showing github.com — doc: link n-api module init to multi-load addons · nodejs/node@c44df51
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/n-api.md +5Lines changed: 5 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -1183,6 +1183,10 @@ This macro includes `NAPI_MODULE`, and declares an `Init` function with a |
1183 | 1183 | special name and with visibility beyond the addon. This will allow Node.js to |
1184 | 1184 | initialize the module even if it is loaded multiple times. |
1185 | 1185 |
|
| 1186 | +There are a few design considerations when declaring a module that may be loaded |
| 1187 | +multiple times. The documentation of [context-aware addons][] provides more |
| 1188 | +details. |
| 1189 | + |
1186 | 1190 | The variables `env` and `exports` will be available inside the function body |
1187 | 1191 | following the macro invocation. |
1188 | 1192 |
|
@@ -4581,3 +4585,4 @@ This API may only be called from the main thread. |
4581 | 4585 | [`process.release`]: process.html#process_process_release |
4582 | 4586 | [`init` hooks]: async_hooks.html#async_hooks_init_asyncid_type_triggerasyncid_resource |
4583 | 4587 | [async_hooks `type`]: async_hooks.html#async_hooks_type |
| 4588 | +[context-aware addons]: addons.html#addons_context_aware_addons |