Skip to content
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

Improve AsyncWorker example handling Object/Buffer/Uint8Array as parameter #380

Open
mahnunchik opened this issue Feb 21, 2024 · 2 comments

Comments

@mahnunchik
Copy link

Hello,

I've created issue in node-addon-api nodejs/node-addon-api#1453 but it may be related more to scope of this repository.

I couldn't find in the documentation and examples how to properly handle Object/Buffer/Uint8Array parameters in AsyncWorker?

nodejs/node-addon-api#1453

@legendecas
Copy link
Member

I believe https://github.com/nodejs/node-addon-examples/tree/main/src/4-references-and-handle-scope/function-reference-demo/node-addon-api can be a good example to prevent objects from being reclaimed by the garbage collector.

@mahnunchik
Copy link
Author

Yes it is good starting point, but working with AsyncWorker is a bit different because it was not clear to me where to wrap and where to release data. Now it is clear for me nodejs/node-addon-api#1453 (comment) but I think example can be added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants