diff options
author | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2017-07-27 20:59:29 +0300 |
---|---|---|
committer | Gabriel Schulhof <gabriel.schulhof@intel.com> | 2017-08-22 12:31:22 +0300 |
commit | 70664bf5a1914e74726cd3d17659cbba8f553f94 (patch) | |
tree | ff1a2c928d7b1140d3fb4bec7e163369d3bb3628 /src/node_api.h | |
parent | 9eb8f44060abdd8b6e42110cc19786194b86b759 (diff) |
n-api: add ability to remove a wrapping
Calling napi_wrap() twice on the same object has the result of returning
napi_invalid_arg on the second call. However, sometimes it is necessary
to replace the native pointer associated with a given object. This new
API allows one to remove an existing pointer, returning the object to
its pristine, non-wrapped state.
PR-URL: https://github.com/nodejs/node/pull/14658
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Fixes: https://github.com/nodejs/abi-stable-node/issues/266
Diffstat (limited to 'src/node_api.h')
-rw-r--r-- | src/node_api.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/node_api.h b/src/node_api.h index 0cf0ba04699..e52e2016d73 100644 --- a/src/node_api.h +++ b/src/node_api.h @@ -362,6 +362,9 @@ NAPI_EXTERN napi_status napi_wrap(napi_env env, NAPI_EXTERN napi_status napi_unwrap(napi_env env, napi_value js_object, void** result); +NAPI_EXTERN napi_status napi_remove_wrap(napi_env env, + napi_value js_object, + void** result); NAPI_EXTERN napi_status napi_create_external(napi_env env, void* data, napi_finalize finalize_cb, |