@@ -7,12 +7,13 @@ _Addons_ are dynamically-linked shared objects written in C++. The
7
7
[ ` require() ` ] [ require ] function can load addons as ordinary Node.js modules.
8
8
Addons provide an interface between JavaScript and C/C++ libraries.
9
9
10
- There are three options for implementing addons: N -API, nan, or direct
10
+ There are three options for implementing addons: Node -API, nan, or direct
11
11
use of internal V8, libuv and Node.js libraries. Unless there is a need for
12
- direct access to functionality which is not exposed by N-API, use N-API.
13
- Refer to [ C/C++ addons with N-API] ( n-api.md ) for more information on N-API.
12
+ direct access to functionality which is not exposed by Node-API, use Node-API.
13
+ Refer to [ C/C++ addons with Node-API] ( n-api.md ) for more information on
14
+ Node-API.
14
15
15
- When not using N -API, implementing addons is complicated,
16
+ When not using Node -API, implementing addons is complicated,
16
17
involving knowledge of several components and APIs:
17
18
18
19
* V8: the C++ library Node.js uses to provide the
@@ -243,7 +244,7 @@ changes:
243
244
In order to be loaded from multiple Node.js environments,
244
245
such as a main thread and a Worker thread, an add-on needs to either:
245
246
246
- * Be an N -API addon, or
247
+ * Be an Node -API addon, or
247
248
* Be declared as context-aware using `NODE_MODULE_INIT()` as described above
248
249
249
250
In order to support [`Worker`][] threads, addons need to clean up any resources
@@ -435,11 +436,11 @@ addon developers are recommended to use to keep compatibility between past and
435
436
future releases of V8 and Node.js. See the ` nan ` [ examples] [ ] for an
436
437
illustration of how it can be used.
437
438
438
- ## N -API
439
+ ## Node -API
439
440
440
441
> Stability: 2 - Stable
441
442
442
- N -API is an API for building native addons. It is independent from
443
+ Node -API is an API for building native addons. It is independent from
443
444
the underlying JavaScript runtime (e.g. V8) and is maintained as part of
444
445
Node.js itself. This API will be Application Binary Interface (ABI) stable
445
446
across versions of Node.js. It is intended to insulate addons from
@@ -449,17 +450,17 @@ recompilation. Addons are built/packaged with the same approach/tools
449
450
outlined in this document (node-gyp, etc.). The only difference is the
450
451
set of APIs that are used by the native code. Instead of using the V8
451
452
or [ Native Abstractions for Node.js] [ ] APIs, the functions available
452
- in the N -API are used.
453
+ in the Node -API are used.
453
454
454
455
Creating and maintaining an addon that benefits from the ABI stability
455
- provided by N -API carries with it certain
456
+ provided by Node -API carries with it certain
456
457
[ implementation considerations] ( n-api.md#n_api_implications_of_abi_stability ) .
457
458
458
- To use N -API in the above "Hello world" example, replace the content of
459
+ To use Node -API in the above "Hello world" example, replace the content of
459
460
` hello.cc ` with the following. All other instructions remain the same.
460
461
461
462
``` cpp
462
- // hello.cc using N -API
463
+ // hello.cc using Node -API
463
464
#include < node_api.h>
464
465
465
466
namespace demo {
@@ -491,7 +492,7 @@ NAPI_MODULE(NODE_GYP_MODULE_NAME, init)
491
492
```
492
493
493
494
The functions available and how to use them are documented in
494
- [C/C++ addons with N -API](n-api.md).
495
+ [C/C++ addons with Node -API](n-api.md).
495
496
496
497
## Addon examples
497
498
0 commit comments