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
Not sure if this is the right repo to ask this, but I was wondering if references to objects (i.e. created with napi_create_reference) can be shared between different native modules and/or napi_envs (assuming of course it runs in the same instance of Node).
For example:
a native module foo that receives an object from JS and creates a reference to keep it around a bit longer;
native module foo makes a native C call to native module bar and passes the reference to bar;
@cutsoy I agree with @mhdawson. It would be safer for modules foo and bar to coordinate via JS. For example, module bar can expose a function that receives as its sole parameter the desired object. Then, the function can be passed into module foo , which will call it with the object. Module bar can then create a second reference to the same object. So, roughly,
Not sure if this is the right repo to ask this, but I was wondering if references to objects (i.e. created with
napi_create_reference
) can be shared between different native modules and/ornapi_env
s (assuming of course it runs in the same instance of Node).For example:
foo
that receives an object from JS and creates a reference to keep it around a bit longer;foo
makes a native C call to native modulebar
and passes the reference tobar
;bar
andbar
callsnapi_get_reference_value
(with a differentnapi_env
).The text was updated successfully, but these errors were encountered: