node-addon-api
Advanced tools
Comparing version 1.2.0 to 1.3.0
@@ -1,1 +0,47 @@ | ||
# Node.js API (N-API) Package Changelog | ||
# node-addon-api Changelog | ||
## 2018-05-08 Version 1.3.0 (Current), @mhdawson | ||
### Notable changes: | ||
#### Documentation | ||
- Added documentation for Scopes | ||
- Added documentation for migration from NAN | ||
- Update documentation to better explain the use of NODE_ADDON_API | ||
#### API | ||
- Implement data manipulation methods for dataview | ||
- Use built-in N-API on Node.js >= 6.14.2 | ||
- Value | ||
- Added IsExternal() | ||
- IsObject() allow functions | ||
- String | ||
- Fixed initialization of std::string to nullptr | ||
#### Tests | ||
- Fix test failures on linuxOne and AIX | ||
- Added basic tests for Scopes | ||
- Fix MSVC warning C4244 in tests | ||
### Commits | ||
* [386c2aeb74] - test: remove dep on later C++ feature (Michael Dawson) https://github.com/nodejs/node-addon-api/pull/267 | ||
* [10697734da] - Use built-in N-API on Node.js >= 6.14.2 (Gabriel Schulhof) | ||
* [75086da273] - test: add basic tests and doc for scopes (Michael Dawson) https://github.com/nodejs/node-addon-api/pull/250 | ||
* [341dbd25d5] - doc: update blurb explaining NODE_ADDON_API (Gabriel Schulhof) https://github.com/nodejs/node-addon-api/pull/251 | ||
* [cf6c93e4ee] - don't try to escape null (Michael Dawson) https://github.com/nodejs/node-addon-api/pull/245 | ||
* [15e4b35fc2] - test: fix MSVC warning C4244 in tests (Kyle Farnung) https://github.com/nodejs/node-addon-api/pull/236 | ||
* [7f3ca03b8e] - Create a doc for migration (Sampson Gao) https://github.com/nodejs/node-addon-api/pull/118 | ||
* [0a2177debe] - Fix test failures on linuxOne and AIX (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/232 | ||
* [d567f4b6b5] - Added Napi::Value::IsExternal() (Eric Bickle) https://github.com/nodejs/node-addon-api/pull/227 | ||
* [1b0f0e004a] - Update node-gyp.md (Michele Campus) https://github.com/nodejs/node-addon-api/pull/226 | ||
* [faf19c4f7a] - Fixed initialization of std::string to nullptr (Eric Bickle) https://github.com/nodejs/node-addon-api/pull/228 | ||
* [9c4d321b57] - Implement data manipulation methods for dataview (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/218 | ||
* [5a39fdca6f] - n-api: throw RangeError napi_create_typedarray() (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/216 | ||
* [1376377202] - Make IsObject() allow functions (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/217 | ||
* [673b59d319] - src: Initial implementation of DataView class (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/205 | ||
* [0a899bf1c5] - doc: update indication of latest version (Michael Dawson) https://github.com/nodejs/node-addon-api/pull/211 | ||
* [17c74e5a5e] - n-api: RangeError in napi_create_dataview() (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/214 | ||
* [4058a29989] - n-api: fix memory leak in napi_async_destroy() (Jinho Bang) https://github.com/nodejs/node-addon-api/pull/213 | ||
@@ -24,2 +24,4 @@ # Creating a release | ||
* Update the README.md to show the new version as the latest. | ||
* Add any new contributors to the "contributors" section in | ||
@@ -26,0 +28,0 @@ the package.json |
@@ -1,5 +0,66 @@ | ||
# Handle scope | ||
# HandleScope | ||
You are reading a draft of the next documentation and it's in continuos update so | ||
if you don't find what you need please refer to: | ||
[C++ wrapper classes for the ABI-stable C APIs for Node.js](https://nodejs.github.io/node-addon-api/) | ||
The HandleScope class is used to manage the lifetime of object handles | ||
which are created through the use of node-addon-api. These handles | ||
keep an object alive in the heap in order to ensure that the objects | ||
are not collected while native code is using them. | ||
A handle may be created when any new node-addon-api Value or one | ||
of its subclasses is created or returned. For more details refer to | ||
the section titled (Object lifetime management)[object_lifetime_management]. | ||
## Methods | ||
### Constructor | ||
Creates a new handle scope. | ||
```cpp | ||
HandleScope HandleScope::New(Napi:Env env); | ||
``` | ||
- `[in] Env`: The environment in which to construct the HandleScope object. | ||
Returns a new HandleScope | ||
### Constructor | ||
Creates a new handle scope. | ||
```cpp | ||
HandleScope HandleScope::New(napi_env env, napi_handle_scope scope); | ||
``` | ||
- `[in] env`: napi_env in which the scope passed in was created. | ||
- `[in] scope`: pre-existing napi_handle_scope. | ||
Returns a new HandleScope instance which wraps the napi_handle_scope | ||
handle passed in. This can be used to mix usage of the C N-API | ||
and node-addon-api. | ||
operator HandleScope::napi_handle_scope | ||
```cpp | ||
operator HandleScope::napi_handle_scope() const | ||
``` | ||
Returns the N-API napi_handle_scope wrapped by the EscapableHandleScope object. | ||
This can be used to mix usage of the C N-API and node-addon-api by allowing | ||
the class to be used be converted to a napi_handle_scope. | ||
### Destructor | ||
```cpp | ||
~HandleScope(); | ||
``` | ||
Deletes the HandleScope instance and allows any objects/handles created | ||
in the scope to be collected by the garbage collector. There is no | ||
guarantee as to when the gargbage collector will do this. | ||
### Env | ||
```cpp | ||
Napi::Env Env() const; | ||
``` | ||
Returns the Napi:Env associated with the HandleScope. |
@@ -10,3 +10,3 @@ # node-gyp | ||
Until now **node-gyp** is the **de-fafto** standard build tool for writing | ||
Until now **node-gyp** is the **de-facto** standard build tool for writing | ||
Node.js addons. It's based on Google's **gyp** build tool, which abstract away | ||
@@ -62,6 +62,8 @@ many of the tedious issues related to cross platform building. | ||
* once the library has been loaded into active memory. The first argument must | ||
* match the "target" in our *binding.gyp*. The second argument points to the | ||
* function to invoke. | ||
* match the "target" in our *binding.gyp*. Using NODE_GYP_MODULE_NAME ensures | ||
* that the argument will be correct, as long as the module is built with | ||
* node-gyp (which is the usual way of building modules). The second argument | ||
* points to the function to invoke. The function must not be namespaced. | ||
*/ | ||
NODE_API_MODULE(myModule, Init) | ||
NODE_API_MODULE(NODE_GYP_MODULE_NAME, Init) | ||
``` | ||
@@ -68,0 +70,0 @@ |
@@ -17,4 +17,6 @@ var path = require('path'); | ||
// that, we indicate that the API is missing from Node.js. | ||
var isNodeApiBuiltin = | ||
(versionArray[0] > 8 || (versionArray[0] == 8 && versionArray[1] > 5)); | ||
var isNodeApiBuiltin = ( | ||
versionArray[0] > 8 || | ||
(versionArray[0] == 8 && versionArray[1] >= 6) || | ||
(versionArray[0] == 6 && versionArray[1] >= 14 && versionArray[2] >= 2)); | ||
@@ -21,0 +23,0 @@ // The flag is not needed when the Node version is not 8, nor if the API is |
@@ -11,6 +11,9 @@ { | ||
"Benjamin Byholm (https://github.com/kkoopa)", | ||
"Cory Mickelson (https://github.com/corymickelson)", | ||
"David Halls (https://github.com/davedoesdev)", | ||
"Eric Bickle (https://github.com/ebickle)", | ||
"Gabriel Schulhof (https://github.com/gabrielschulhof)", | ||
"Hitesh Kanwathirtha (https://github.com/digitalinfinity)", | ||
"Jason Ginchereau (https://github.com/jasongin)", | ||
"Jim Schlight (https://github.com/jschlight)", | ||
"Jinho Bang (https://github.com/romandev)", | ||
@@ -21,2 +24,3 @@ "Konstantin Tarkus (https://github.com/koistya)", | ||
"Michael Dawson (https://github.com/mhdawson)", | ||
"Michele Campus (https://github.com/kYroL01)", | ||
"Nicola Del Gobbo (https://github.com/NickNaso)", | ||
@@ -48,3 +52,3 @@ "Rolf Timmermans (https://github.com/rolftimmermans)", | ||
}, | ||
"version": "1.2.0" | ||
"version": "1.3.0" | ||
} |
@@ -32,3 +32,3 @@ # **Node.js API (N-API) Package** | ||
## **Current version: 1.1.0** | ||
## **Current version: 1.3** | ||
@@ -68,3 +68,3 @@ (See [CHANGELOG.md](CHANGELOG.md) for complete Changelog) | ||
- [Error](doc/error.md) | ||
- [Object Lifettime Management](doc/object_lifetime_management.md) | ||
- [Object Lifetime Management](doc/object_lifetime_management.md) | ||
- [HandleScope](doc/handle_scope.md) | ||
@@ -132,2 +132,3 @@ - [EscapableHandleScope](doc/escapable_handle_scope.md) | ||
| Michael Dawson | [mhdawson](https://github.com/mhdawson) | | ||
| Nicola Del Gobbo | [NickNaso](https://github.com/NickNaso) | | ||
| Sampson Gao | [sampsongao](https://github.com/sampsongao) | | ||
@@ -134,0 +135,0 @@ | Taylor Woll | [boingoing](https://github.com/boingoing) | |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
503682
61
289
137