-
Notifications
You must be signed in to change notification settings - Fork 459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Best practice to store context-aware class constructor reference #654
Comments
@legendecas I was planning on writing a class |
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: #654
It turns out that adding such a class would mean that we'd have to pretty much duplicate the entire API for creating functions, classes, and property descriptors. So AFAICT it's best to do what #663 does, which is to make the data available on the |
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Fixes: nodejs#654
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Signed-off-by: Gabriel Schulhof <[email protected]> Fixes: nodejs/node-addon-api#654 PR-URL: nodejs/node-addon-api#663 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Signed-off-by: Gabriel Schulhof <[email protected]> Fixes: nodejs/node-addon-api#654 PR-URL: nodejs/node-addon-api#663 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Signed-off-by: Gabriel Schulhof <[email protected]> Fixes: nodejs/node-addon-api#654 PR-URL: nodejs/node-addon-api#663 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
Support `napi_get_instance_data()` and `napi_set_instance_data()`. Signed-off-by: Gabriel Schulhof <[email protected]> Fixes: nodejs/node-addon-api#654 PR-URL: nodejs/node-addon-api#663 Reviewed-By: Chengzhong Wu <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
I've seen many users just store the class constructor reference statically for later use. This will definitely cause issues if the addon is used in both master thread and worker threads. We shall document the best practice to prevent such pitfalls. Or was I just missed such docs?
The text was updated successfully, but these errors were encountered: