src: add NAPI_VERSION_EXPERIMENTAL

Refs: https://github.com/nodejs/node-addon-api/issues/421

Define NAPI_VERSION_EXPERIMENTAL so that it can be
used to guard code in addons that need to check
if a function they want to use is available.

PR-URL: https://github.com/nodejs/node/pull/25319
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Michael Dawson committed 2019-01-04 16:48:56 -05:00
1 parent 9dfbc391fa
commit 992c8ab476
1 file changed
+3 -2
+3 -2
View File
@@ -5,10 +5,11 @@
#include <stdbool.h>
#include "js_native_api_types.h"
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
#define NAPI_VERSION_EXPERIMENTAL 2147483647
#ifndef NAPI_VERSION
#ifdef NAPI_EXPERIMENTAL
// Use INT_MAX, this should only be consumed by the pre-processor anyway.
#define NAPI_VERSION 2147483647
#define NAPI_VERSION NAPI_VERSION_EXPERIMENTAL
#else
// The baseline version for N-API
#define NAPI_VERSION 3