In our ObjectWrap N-API examples we store the napi_ref returned from napi_wrap() in the native object instance although we never use it. To napi_delete_reference() in the destructor we need to also store the napi_env on the native instance – a practice we discourage.
Do we do this for illustration purposes? Can we remove this, since wrapper_ is not being used anywhere?
In our ObjectWrap N-API examples we store the
napi_refreturned fromnapi_wrap()in the native object instance although we never use it. Tonapi_delete_reference()in the destructor we need to also store thenapi_envon the native instance – a practice we discourage.Do we do this for illustration purposes? Can we remove this, since
wrapper_is not being used anywhere?