Browse Source

doc: Add initial documentation for N-API

Add the initial documentation for the N-API

This PR is a result of work in the abi-stable-node repo:
https://github.com/nodejs/abi-stable-node/tree/doc,
with this PR being the cumulative work on the documentation
sections in that repo with the following contributors
in alphabetical order:

Author: Arunesh Chandra <arunesh.chandra@microsoft.com>
Author: Gabriel Schulhof <gabriel.schulhof@intel.com>
Author: Hitesh Kanwathirtha <hiteshk@microsoft.com>
Author: Jason Ginchereau <jasongin@microsoft.com>
Author: Michael Dawson <michael_dawson@ca.ibm.com>
Author: Sampson Gao <sampsong@ca.ibm.com>
Author: Taylor Woll <taylor.woll@microsoft.com>

PR-URL: https://github.com/nodejs/node/pull/12549
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
v6
Michael Dawson 8 years ago
parent
commit
deb9622b11
  1. 1
      doc/api/_toc.md
  2. 20
      doc/api/addons.md
  3. 2998
      doc/api/n-api.md

1
doc/api/_toc.md

@ -8,6 +8,7 @@
* [Assertion Testing](assert.html) * [Assertion Testing](assert.html)
* [Buffer](buffer.html) * [Buffer](buffer.html)
* [C/C++ Addons](addons.html) * [C/C++ Addons](addons.html)
* [C/C++ Addons - N-API](n-api.html)
* [Child Processes](child_process.html) * [Child Processes](child_process.html)
* [Cluster](cluster.html) * [Cluster](cluster.html)
* [Command Line Options](cli.html) * [Command Line Options](cli.html)

20
doc/api/addons.md

@ -213,6 +213,26 @@ Addon developers are recommended to use to keep compatibility between past and
future releases of V8 and Node.js. See the `nan` [examples][] for an future releases of V8 and Node.js. See the `nan` [examples][] for an
illustration of how it can be used. illustration of how it can be used.
## N-API
> Stability: 1 - Experimental
N-API is an API for building native Addons. It is independent from
the underlying JavaScript runtime (ex V8) and is maintained as part of
Node.js itself. This API will be Application Binary Interface (ABI) stable
across version of Node.js. It is intended to insulate Addons from
changes in the underlying JavaScript engine and allow modules
compiled for one version to run on later versions of Node.js without
recompilation. Addons are built/packaged with the same approach/tools
outlined in this document (node-gyp, etc.). The only difference is the
set of APIs that are used by the native code. Instead of using the V8
or [Native Abstractions for Node.js][] APIs, the functions available
in the N-API are used.
The functions available and how to use them are documented in the
section titled [C/C++ Addons - N-API](n-api.html).
## Addon examples ## Addon examples
Following are some example Addons intended to help developers get started. The Following are some example Addons intended to help developers get started. The

2998
doc/api/n-api.md

File diff suppressed because it is too large
Loading…
Cancel
Save