diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-07-19 14:44:35 -0400 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2018-07-23 23:39:56 -0400 |
commit | 5384570486d63a75032f47687b5082aeca86faf8 (patch) | |
tree | 4a0cfa0054f55a60222f581c98576d58d07b5925 /doc/api/n-api.md | |
parent | 53296e8a3e72fe2b3c2a3391fce59d2ef0f32c59 (diff) | |
download | android-node-v8-5384570486d63a75032f47687b5082aeca86faf8.tar.gz android-node-v8-5384570486d63a75032f47687b5082aeca86faf8.tar.bz2 android-node-v8-5384570486d63a75032f47687b5082aeca86faf8.zip |
doc: link n-api module init to multi-load addons
Add a blurb to the documentation of `NAPI_MODULE_INIT()` pointing to
the discussion of the consequences of providing an addon that can be
loaded multiple times from multiple contexts.
PR-URL: https://github.com/nodejs/node/pull/21891
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r-- | doc/api/n-api.md | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md index 44223e1902..796dc4ad27 100644 --- a/doc/api/n-api.md +++ b/doc/api/n-api.md @@ -1183,6 +1183,10 @@ This macro includes `NAPI_MODULE`, and declares an `Init` function with a special name and with visibility beyond the addon. This will allow Node.js to initialize the module even if it is loaded multiple times. +There are a few design considerations when declaring a module that may be loaded +multiple times. The documentation of [context-aware addons][] provides more +details. + The variables `env` and `exports` will be available inside the function body following the macro invocation. @@ -4581,3 +4585,4 @@ This API may only be called from the main thread. [`process.release`]: process.html#process_process_release [`init` hooks]: async_hooks.html#async_hooks_init_asyncid_type_triggerasyncid_resource [async_hooks `type`]: async_hooks.html#async_hooks_type +[context-aware addons]: addons.html#addons_context_aware_addons |