node-addon-api
Advanced tools
| # CallbackScope | ||
| There are cases (for example, resolving promises) where it is necessary to have | ||
| the equivalent of the scope associated with a callback in place when making | ||
| certain N-API calls. | ||
| ## Methods | ||
| ### Constructor | ||
| Creates a new callback scope on the stack. | ||
| ```cpp | ||
| Napi::CallbackScope::CallbackScope(napi_env env, napi_callback_scope scope); | ||
| ``` | ||
| - `[in] env`: The environment in which to create the `Napi::CallbackScope`. | ||
| - `[in] scope`: The pre-existing `napi_callback_scope` or `Napi::CallbackScope`. | ||
| ### Constructor | ||
| Creates a new callback scope on the stack. | ||
| ```cpp | ||
| Napi::CallbackScope::CallbackScope(napi_env env, napi_async_context context); | ||
| ``` | ||
| - `[in] env`: The environment in which to create the `Napi::CallbackScope`. | ||
| - `[in] async_context`: The pre-existing `napi_async_context` or `Napi::AsyncContext`. | ||
| ### Destructor | ||
| Deletes the instance of `Napi::CallbackScope` object. | ||
| ```cpp | ||
| virtual Napi::CallbackScope::~CallbackScope(); | ||
| ``` | ||
| ### Env | ||
| ```cpp | ||
| Napi::Env Napi::CallbackScope::Env() const; | ||
| ``` | ||
| Returns the `Napi::Env` associated with the `Napi::CallbackScope`. | ||
| ## Operator | ||
| ```cpp | ||
| Napi::CallbackScope::operator napi_callback_scope() const; | ||
| ``` | ||
| Returns the N-API `napi_callback_scope` wrapped by the `Napi::CallbackScope` | ||
| object. This can be used to mix usage of the C N-API and node-addon-api. |
+33
-3
| # node-addon-api Changelog | ||
| ## 2018-10-03 Version 1.5.0 (Current), @NickNasso | ||
| ## 2018-11-02 Version 1.6.0 (Current), @NickNaso | ||
@@ -9,2 +9,32 @@ ### Notable changes: | ||
| - Improved documentation about ABI stability. | ||
| #### API | ||
| - Add `Napi::CallbackScope` class that help to have the equivalent of the scope | ||
| associated with a callback in place when making certain N-API calls | ||
| #### TEST | ||
| - Added tests for `Napi::Array` class. | ||
| - Added tests for `Napi::ArrayBuffer` class. | ||
| ### Commmits | ||
| * [[`8ce605c657`](https://github.com/nodejs/node-addon-api/commit/8ce605c657)] - **build**: avoid using package-lock.json (Jaeseok Yoon) [#359](https://github.com/nodejs/node-addon-api/pull/359) | ||
| * [[`fa3a6150b3`](https://github.com/nodejs/node-addon-api/commit/fa3a6150b3)] - **src**: use MakeCallback() -\> Call() in AsyncWorker (Jinho Bang) [#361](https://github.com/nodejs/node-addon-api/pull/361) | ||
| * [[`2342415463`](https://github.com/nodejs/node-addon-api/commit/2342415463)] - **test**: create test objects in the stack instead of the heap (Dongjin Na) [#371](https://github.com/nodejs/node-addon-api/pull/371) | ||
| * [[`67b7db0a6f`](https://github.com/nodejs/node-addon-api/commit/67b7db0a6f)] - **test**: write tests for Array class (Jaeseok Yoon) [#363](https://github.com/nodejs/node-addon-api/pull/363) | ||
| * [[`729f6dc4ee`](https://github.com/nodejs/node-addon-api/commit/729f6dc4ee)] - **test**: add arraybuffer tests (Dongjin Na) [#369](https://github.com/nodejs/node-addon-api/pull/369) | ||
| * [[`405f3e5b5b`](https://github.com/nodejs/node-addon-api/commit/405f3e5b5b)] - **src**: implement CallbackScope class (Jinho Bang) [#362](https://github.com/nodejs/node-addon-api/pull/362) | ||
| * [[`015d95312f`](https://github.com/nodejs/node-addon-api/commit/015d95312f)] - **doc**: fix Napi::Reference link (Gentilhomme) [#365](https://github.com/nodejs/node-addon-api/pull/365) | ||
| * [[`fd65078e3c`](https://github.com/nodejs/node-addon-api/commit/fd65078e3c)] - README.md: link to new ABI stability guide (Gabriel Schulhof) [#367](https://github.com/nodejs/node-addon-api/pull/367) | ||
| * [[`ffebf9ba9a`](https://github.com/nodejs/node-addon-api/commit/ffebf9ba9a)] - Updates for release 1.5.0 (NickNaso) | ||
| ## 2018-10-03 Version 1.5.0 (Current), @NickNaso | ||
| ### Notable changes: | ||
| #### Documentation | ||
| - Completed the documentation to cover all the API surface. | ||
@@ -16,3 +46,3 @@ - Numerous fixes to make documentation more consistent in all of its parts. | ||
| - Add `Napi::AsyncContext` class to handle asynchronous operation. | ||
| - Add B`Napi::igInt` class to work with BigInt type. | ||
| - Add `Napi::BigInt` class to work with BigInt type. | ||
| - Add `Napi::VersionManagement` class to retrieve the versions of Node.js and N-API. | ||
@@ -70,3 +100,3 @@ - Fix potential memory leaks. | ||
| ## 2018-07-19 Version 1.4.0, @NickNasso | ||
| ## 2018-07-19 Version 1.4.0, @NickNaso | ||
@@ -73,0 +103,0 @@ ### Notable changes: |
@@ -30,1 +30,3 @@ # Asynchronous operations | ||
| - **[AsyncContext](async_context.md)** | ||
| - **[CallbackScope](callback_scope.md)** |
@@ -5,3 +5,3 @@ # Object Reference | ||
| For more general information on references, please consult [`Napi::Reference`](referenc.md). | ||
| For more general information on references, please consult [`Napi::Reference`](reference.md). | ||
@@ -8,0 +8,0 @@ ## Example |
+3
-2
@@ -36,3 +36,4 @@ { | ||
| "Sampson Gao (https://github.com/sampsongao)", | ||
| "Taylor Woll (https://github.com/boingoing)" | ||
| "Taylor Woll (https://github.com/boingoing)", | ||
| "Thomas Gentilhomme (https://github.com/fraxken)" | ||
| ], | ||
@@ -60,3 +61,3 @@ "dependencies": {}, | ||
| }, | ||
| "version": "1.5.0" | ||
| "version": "1.6.0" | ||
| } |
+7
-3
@@ -22,6 +22,8 @@ # **node-addon-api module** | ||
| `libuv` (included in a project via `#include <uv.h>`) are not ABI-stable across | ||
| Node.js major versions. Thus, and addon must use N-API and/or `node-addon-api` | ||
| Node.js major versions. Thus, an addon must use N-API and/or `node-addon-api` | ||
| exclusively and build against a version of Node.js that includes an | ||
| implementation of N-API (meaning a version of Node.js newer than 6.14.2) in | ||
| order to benefit from ABI stability across Node.js major versions. | ||
| order to benefit from ABI stability across Node.js major versions. Node.js | ||
| provides an [ABI stability guide][] containing a detailed explanation of ABI | ||
| stability in general, and the N-API ABI stability guarantee in particular. | ||
@@ -48,3 +50,3 @@ As new APIs are added to N-API, node-addon-api must be updated to provide | ||
| ## **Current version: 1.5** | ||
| ## **Current version: 1.6** | ||
@@ -172,1 +174,3 @@ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog) | ||
| Licensed under [MIT](./LICENSE.md) | ||
| [ABI stability guide]: https://nodejs.org/en/docs/guides/abi-stability/ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Shell access
Supply chain riskThis module accesses the system shell. Accessing the system shell increases the risk of executing arbitrary code.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
691819
0.72%72
1.41%174
2.35%