| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent d8d851a commit ebf3597
6 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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 | |
@@ -245,7 +246,7 @@ changes: | |||
| 245 | 246 | In order to be loaded from multiple Node.js environments, | |
| 246 | 247 | such as a main thread and a Worker thread, an add-on needs to either: | |
| 247 | 248 | ||
| 248 | - * Be an N-API addon, or | ||
| 249 | + * Be an Node-API addon, or | ||
| 249 | 250 | * Be declared as context-aware using `NODE_MODULE_INIT()` as described above | |
| 250 | 251 | ||
| 251 | 252 | In order to support [`Worker`][] threads, addons need to clean up any resources | |
@@ -437,11 +438,11 @@ addon developers are recommended to use to keep compatibility between past and | |||
| 437 | 438 | future releases of V8 and Node.js. See the `nan` [examples][] for an | |
| 438 | 439 | illustration of how it can be used. | |
| 439 | 440 | ||
| 440 | - ## N-API | ||
| 441 | + ## Node-API | ||
| 441 | 442 | ||
| 442 | 443 | > Stability: 2 - Stable | |
| 443 | 444 | ||
| 444 | - N-API is an API for building native addons. It is independent from | ||
| 445 | + Node-API is an API for building native addons. It is independent from | ||
| 445 | 446 | the underlying JavaScript runtime (e.g. V8) and is maintained as part of | |
| 446 | 447 | Node.js itself. This API will be Application Binary Interface (ABI) stable | |
| 447 | 448 | across versions of Node.js. It is intended to insulate addons from | |
@@ -451,17 +452,17 @@ recompilation. Addons are built/packaged with the same approach/tools | |||
| 451 | 452 | outlined in this document (node-gyp, etc.). The only difference is the | |
| 452 | 453 | set of APIs that are used by the native code. Instead of using the V8 | |
| 453 | 454 | or [Native Abstractions for Node.js][] APIs, the functions available | |
| 454 | - in the N-API are used. | ||
| 455 | + in the Node-API are used. | ||
| 455 | 456 | ||
| 456 | 457 | Creating and maintaining an addon that benefits from the ABI stability | |
| 457 | - provided by N-API carries with it certain | ||
| 458 | + provided by Node-API carries with it certain | ||
| 458 | 459 | [implementation considerations](n-api.md#n_api_implications_of_abi_stability). | |
| 459 | 460 | ||
| 460 | - To use N-API in the above "Hello world" example, replace the content of | ||
| 461 | + To use Node-API in the above "Hello world" example, replace the content of | ||
| 461 | 462 | `hello.cc` with the following. All other instructions remain the same. | |
| 462 | 463 | ||
| 463 | 464 | ```cpp | |
| 464 | - // hello.cc using N-API | ||
| 465 | + // hello.cc using Node-API | ||
| 465 | 466 | #include <node_api.h> | |
| 466 | 467 | ||
| 467 | 468 | namespace demo { | |
@@ -493,7 +494,7 @@ NAPI_MODULE(NODE_GYP_MODULE_NAME, init) | |||
| 493 | 494 | ``` | |
| 494 | 495 | ||
| 495 | 496 | The functions available and how to use them are documented in | |
| 496 | - [C/C++ addons with N-API](n-api.md). | ||
| 497 | + [C/C++ addons with Node-API](n-api.md). | ||
| 497 | 498 | ||
| 498 | 499 | ## Addon examples | |
| 499 | 500 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1823,7 +1823,7 @@ would be possible by calling a callback more than once. | |||
| 1823 | 1823 | <a id="ERR_NAPI_CONS_FUNCTION"></a> | |
| 1824 | 1824 | ### `ERR_NAPI_CONS_FUNCTION` | |
| 1825 | 1825 | ||
| 1826 | - While using `N-API`, a constructor passed was not a function. | ||
| 1826 | + While using `Node-API`, a constructor passed was not a function. | ||
| 1827 | 1827 | ||
| 1828 | 1828 | <a id="ERR_NAPI_INVALID_DATAVIEW_ARGS"></a> | |
| 1829 | 1829 | ### `ERR_NAPI_INVALID_DATAVIEW_ARGS` | |
@@ -2559,7 +2559,7 @@ added: v9.0.0 | |||
| 2559 | 2559 | removed: v10.0.0 | |
| 2560 | 2560 | --> | |
| 2561 | 2561 | ||
| 2562 | - Used by the `N-API` when `Constructor.prototype` is not an object. | ||
| 2562 | + Used by the `Node-API` when `Constructor.prototype` is not an object. | ||
| 2563 | 2563 | ||
| 2564 | 2564 | <a id="ERR_NO_LONGER_SUPPORTED"></a> | |
| 2565 | 2565 | ### `ERR_NO_LONGER_SUPPORTED` | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -14,7 +14,7 @@ | |||
| 14 | 14 | * [Async hooks](async_hooks.md) | |
| 15 | 15 | * [Buffer](buffer.md) | |
| 16 | 16 | * [C++ addons](addons.md) | |
| 17 | - * [C/C++ addons with N-API](n-api.md) | ||
| 17 | + * [C/C++ addons with Node-API](n-api.md) | ||
| 18 | 18 | * [C++ embedder API](embedding.md) | |
| 19 | 19 | * [Child processes](child_process.md) | |
| 20 | 20 | * [Cluster](cluster.md) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments