You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently the ObjectWrap implementation does not extend Reference, which leads to API differences between Napi-JSI and Napi-Direct implementations. For example you cannot call Value() to get access to the JS Object from the context of the C++ class.
Describe the solution you'd like
We should change ObjectWrap to extend Reference to match the implementation in Napi-Direct. Here is an example of the proposed change: b213bea
This change needs to be updated to either make Reference to use a weak reference via JSI::WeakObject or otherwise handle cleanup to allow for GC to clean up stale JS objects.
Describe alternatives you've considered
Currently we can set properties via the InstanceAccessor or by storing a persistent reference to the object in the constructor. The first approach has performance issues for heavily accessed code paths as it requires marshalling to and from the JS context repeatedly, and the second requires managing the lifetime of the reference natively and does not allow JS GC to run.
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Currently the ObjectWrap implementation does not extend Reference, which leads to API differences between Napi-JSI and Napi-Direct implementations. For example you cannot call Value() to get access to the JS Object from the context of the C++ class.
Describe the solution you'd like
We should change ObjectWrap to extend Reference to match the implementation in Napi-Direct. Here is an example of the proposed change: b213bea
This change needs to be updated to either make Reference to use a weak reference via JSI::WeakObject or otherwise handle cleanup to allow for GC to clean up stale JS objects.
Describe alternatives you've considered
Currently we can set properties via the InstanceAccessor or by storing a persistent reference to the object in the constructor. The first approach has performance issues for heavily accessed code paths as it requires marshalling to and from the JS context repeatedly, and the second requires managing the lifetime of the reference natively and does not allow JS GC to run.
The text was updated successfully, but these errors were encountered: