Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

n-api: move cleanup_hook to version 4 #21807

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/node_api.h
Expand Up @@ -623,6 +623,10 @@ NAPI_EXTERN napi_status napi_close_callback_scope(napi_env env,

NAPI_EXTERN napi_status napi_fatal_exception(napi_env env, napi_value err);

#endif // NAPI_VERSION >= 3

#if NAPI_VERSION >= 4

NAPI_EXTERN napi_status napi_add_env_cleanup_hook(napi_env env,
void (*fun)(void* arg),
void* arg);
Expand All @@ -631,7 +635,7 @@ NAPI_EXTERN napi_status napi_remove_env_cleanup_hook(napi_env env,
void (*fun)(void* arg),
void* arg);

#endif // NAPI_VERSION >= 3
#endif // NAPI_VERSION >= 4

#ifdef NAPI_EXPERIMENTAL

Expand Down
2 changes: 1 addition & 1 deletion src/node_version.h
Expand Up @@ -114,6 +114,6 @@
#define NODE_MODULE_VERSION 64

// the NAPI_VERSION provided by this version of the runtime
#define NAPI_VERSION 3
#define NAPI_VERSION 4

#endif // SRC_NODE_VERSION_H_
1 change: 1 addition & 0 deletions test/addons-napi/test_cleanup_hook/binding.cc
@@ -1,3 +1,4 @@
#define NAPI_VERSION 4
#include "node_api.h"
#include "uv.h"
#include "../common.h"
Expand Down
4 changes: 2 additions & 2 deletions test/addons-napi/test_general/test.js
Expand Up @@ -33,8 +33,8 @@ assert.notStrictEqual(test_general.testGetPrototype(baseObject),
test_general.testGetPrototype(extendedObject));

// test version management functions
// expected version is currently 3
assert.strictEqual(test_general.testGetVersion(), 3);
// expected version is currently 4
assert.strictEqual(test_general.testGetVersion(), 4);

const [ major, minor, patch, release ] = test_general.testGetNodeVersion();
assert.strictEqual(process.version.split('-')[0],
Expand Down