Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Dawson <mdawson@devrus.com>2020-09-15 00:37:30 +0300
committerMichael Dawson <mdawson@devrus.com>2020-09-19 00:22:55 +0300
commitf4586c902a721164c8af3c0e11db859f102dfe2e (patch)
tree325479f4be55af51f991ae9cfb08df254ffaccd6 /doc/api/n-api.md
parenta63b90e8b1e2fd35afe3f7994207da66a315fc1e (diff)
doc: clarify use of NAPI_EXPERIMENTAL
We've had a few questions about APIs not being available which were related to not having specified `NAPI_EXPERIMENTAL`. Add some additional documentation to explain this common issue: Refs: https://github.com/nodejs/node-addon-api/issues/810 Signed-off-by: Michael Dawson <mdawson@devrus.com> PR-URL: https://github.com/nodejs/node/pull/35195 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Diffstat (limited to 'doc/api/n-api.md')
-rw-r--r--doc/api/n-api.md12
1 files changed, 12 insertions, 0 deletions
diff --git a/doc/api/n-api.md b/doc/api/n-api.md
index c02a034e2a9..c5a2d810c0b 100644
--- a/doc/api/n-api.md
+++ b/doc/api/n-api.md
@@ -337,6 +337,18 @@ listed as supporting a later version.
version 1 but continued to evolve until Node.js 8.6.0. The API is different in
versions prior to Node.js 8.6.0. We recommend N-API version 3 or later.
+Each API documented for N-API will have a header named `added in:`, and APIs
+which are stable will have the additional header `N-API version:`.
+APIs are directly usable when using a Node.js version which supports
+the N-API version shown in `N-API version:` or higher.
+When using a Node.js version that does not support the
+`N-API version:` listed or if there is no `N-API version:` listed,
+then the API will only be available if
+`#define NAPI_EXPERIMENTAL` precedes the inclusion of `node_api.h`
+or `js_native_api.h`. If an API appears not to be available on
+a version of Node.js which is later than the one shown in `added in:` then
+this is most likely the reason for the apparent absence.
+
The N-APIs associated strictly with accessing ECMAScript features from native
code can be found separately in `js_native_api.h` and `js_native_api_types.h`.
The APIs defined in these headers are included in `node_api.h` and