diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-08-08 19:09:28 +0200 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-08-12 21:28:59 +0200 |
commit | 835c383969d9bddc3980b9cd7f0d7adf3e2701b9 (patch) | |
tree | 67852e9eb9d7399a9a570ac9a9e4d0920ca927de /src/node_api.cc | |
parent | 8780e1d79b2162f95a50ec350b045868e93cac47 (diff) | |
download | android-node-v8-835c383969d9bddc3980b9cd7f0d7adf3e2701b9.tar.gz android-node-v8-835c383969d9bddc3980b9cd7f0d7adf3e2701b9.tar.bz2 android-node-v8-835c383969d9bddc3980b9cd7f0d7adf3e2701b9.zip |
n-api: add napi_get_node_version
Add `napi_get_node_version`, to help with feature-detecting
Node.js as an environment.
PR-URL: https://github.com/nodejs/node/pull/14696
Reviewed-By: Kyle Farnung <kfarnung@microsoft.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Diffstat (limited to 'src/node_api.cc')
-rw-r--r-- | src/node_api.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/src/node_api.cc b/src/node_api.cc index 32acced231..b84a33e510 100644 --- a/src/node_api.cc +++ b/src/node_api.cc @@ -3119,6 +3119,20 @@ napi_status napi_get_version(napi_env env, uint32_t* result) { return napi_clear_last_error(env); } +napi_status napi_get_node_version(napi_env env, + const napi_node_version** result) { + CHECK_ENV(env); + CHECK_ARG(env, result); + static const napi_node_version version = { + NODE_MAJOR_VERSION, + NODE_MINOR_VERSION, + NODE_PATCH_VERSION, + NODE_RELEASE + }; + *result = &version; + return napi_clear_last_error(env); +} + namespace uvimpl { static napi_status ConvertUVErrorCode(int code) { |