Skip to content

Commit

Permalink
n-api: create N-API version 7
Browse files Browse the repository at this point in the history
Mark `napi_detach_arraybuffer` and `napi_is_detached_arraybuffer` as
stable.

Signed-off-by: Gabriel Schulhof <[email protected]>
PR-URL: #35199
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Jiawen Geng <[email protected]>
Reviewed-By: Chengzhong Wu <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
  • Loading branch information
Gabriel Schulhof committed Sep 19, 2020
1 parent f4586c9 commit 31b3202
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 2 additions & 4 deletions doc/api/n-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -3558,10 +3558,9 @@ added:
- v13.0.0
- v12.16.0
- v10.22.0
napiVersion: 7
-->

> Stability: 1 - Experimental

```c
napi_status napi_detach_arraybuffer(napi_env env,
napi_value arraybuffer)
Expand All @@ -3587,10 +3586,9 @@ added:
- v13.3.0
- v12.16.0
- v10.22.0
napiVersion: 7
-->

> Stability: 1 - Experimental

```c
napi_status napi_is_detached_arraybuffer(napi_env env,
napi_value arraybuffer,
Expand Down
7 changes: 5 additions & 2 deletions src/js_native_api.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// functions available in a new version of N-API that is not yet ported in all
// LTS versions, they can set NAPI_VERSION knowing that they have specifically
// depended on that version.
#define NAPI_VERSION 6
#define NAPI_VERSION 7
#endif
#endif

Expand Down Expand Up @@ -529,14 +529,17 @@ NAPI_EXTERN napi_status napi_get_instance_data(napi_env env,
void** data);
#endif // NAPI_VERSION >= 6

#ifdef NAPI_EXPERIMENTAL
#if NAPI_VERSION >= 7
// ArrayBuffer detaching
NAPI_EXTERN napi_status napi_detach_arraybuffer(napi_env env,
napi_value arraybuffer);

NAPI_EXTERN napi_status napi_is_detached_arraybuffer(napi_env env,
napi_value value,
bool* result);
#endif // NAPI_VERSION >= 7

#ifdef NAPI_EXPERIMENTAL
// Type tagging
NAPI_EXTERN napi_status napi_type_tag_object(napi_env env,
napi_value value,
Expand Down
2 changes: 1 addition & 1 deletion src/node_version.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,6 @@

// The NAPI_VERSION provided by this version of the runtime. This is the version
// which the Node binary being built supports.
#define NAPI_VERSION 6
#define NAPI_VERSION 7

#endif // SRC_NODE_VERSION_H_
2 changes: 1 addition & 1 deletion test/js-native-api/test_general/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject));

// Test version management functions
assert.strictEqual(test_general.testGetVersion(), 6);
assert.strictEqual(test_general.testGetVersion(), 7);

[
123,
Expand Down
1 change: 0 additions & 1 deletion test/js-native-api/test_typedarray/test_typedarray.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#define NAPI_EXPERIMENTAL
#include <js_native_api.h>
#include <string.h>
#include <stdlib.h>
Expand Down

0 comments on commit 31b3202

Please sign in to comment.