Skip to content

Commit 6669eff

Browse files
mhdawsonaddaleax
authored andcommitted
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: nodejs/node-addon-api#810 Signed-off-by: Michael Dawson <[email protected]> PR-URL: #35195 Reviewed-By: Jiawen Geng <[email protected]> Reviewed-By: Gabriel Schulhof <[email protected]> Reviewed-By: Chengzhong Wu <[email protected]>
1 parent 89636e3 commit 6669eff

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

doc/api/n-api.md

+12
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,18 @@ listed as supporting a later version.
257257

258258
\* Indicates that the N-API version was released as experimental
259259

260+
Each API documented for N-API will have a header named `added in:`, and APIs
261+
which are stable will have the additional header `N-API version:`.
262+
APIs are directly usable when using a Node.js version which supports
263+
the N-API version shown in `N-API version:` or higher.
264+
When using a Node.js version that does not support the
265+
`N-API version:` listed or if there is no `N-API version:` listed,
266+
then the API will only be available if
267+
`#define NAPI_EXPERIMENTAL` precedes the inclusion of `node_api.h`
268+
or `js_native_api.h`. If an API appears not to be available on
269+
a version of Node.js which is later than the one shown in `added in:` then
270+
this is most likely the reason for the apparent absence.
271+
260272
The N-APIs associated strictly with accessing ECMAScript features from native
261273
code can be found separately in `js_native_api.h` and `js_native_api_types.h`.
262274
The APIs defined in these headers are included in `node_api.h` and

0 commit comments

Comments
 (0)