napi_remove_wrap


napi_status napi_remove_wrap(napi_env env,
                             napi_value js_object,
                             void** result); 
  • [in] env:调用该 API 时所处的环境。
  • [in] js_object:与本地实例关联的对象。
  • [out] result:指向封装的原生实例的指针。

如果 API 成功,则返回 napi_ok

【Returns napi_ok if the API succeeded.】

获取之前使用 napi_wrap() 封装在 JavaScript 对象 js_object 中的本地实例,并移除该封装。如果封装关联了终结回调,当 JavaScript 对象被垃圾回收时,该回调将不再被调用。

【Retrieves a native instance that was previously wrapped in the JavaScript object js_object using napi_wrap() and removes the wrapping. If a finalize callback was associated with the wrapping, it will no longer be called when the JavaScript object becomes garbage-collected.】