napi_remove_wrap


napi_status napi_remove_wrap(napi_env env,
                             napi_value js_object,
                             void** result); 
  • [in] env:调用 API 的环境。

    ¥[in] env: The environment that the API is invoked under.

  • [in] js_object:与原生实例关联的对象。

    ¥[in] js_object: The object associated with the native instance.

  • [out] result:指向封装的原生实例的指针。

    ¥[out] result: Pointer to the wrapped native instance.

如果 API 成功,则返回 napi_ok

¥Returns napi_ok if the API succeeded.

使用 napi_wrap() 检索先前封装在 JavaScript 对象 js_object 中的原生实例并移除封装。如果 finalize 回调与封装相关联,则当 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.