-
Notifications
You must be signed in to change notification settings - Fork 596
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
Need an example of using napi_create_async_work() #82
Comments
There it is on nodejs repo test napi. But bug or not a bug. Process crashes when invoking the same async function twice and more times. Did you tried their sample on your comp? |
By the way here is a simplified example of napi create async work: |
The original example is hosted here: https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate Rewrite all the logic using **node-addon-api** See the following issue https://github.com/nodejs/abi-stable-node-addon-examples/issues/10
Porting asynchronous example from NAN repo. The original example is hosted here: https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate. Rewrite all the logic using **node-addon-api** See the following issue https://github.com/nodejs/abi-stable-node-addon-examples/issues/10 Added examples for event emitter See: nodejs/node-addon-api#110
Porting asynchronous example from NAN repo. The original example is hosted here: https://github.com/nodejs/nan/tree/master/examples/async_pi_estimate. Rewrite all the logic using **node-addon-api** See the following issue https://github.com/nodejs/abi-stable-node-addon-examples/issues/10 Added examples for event emitter See: nodejs/node-addon-api#110
Emit event from cpp is good, but how to the same with a pure c's node_api.h? |
If you are wandering about how to emit an event from plain C to node.js: |
@Globik it would be great if you could create examples that could be added to: https://github.com/nodejs/abi-stable-node-addon-examples |
@mhdawson how to do it? Do I need a pull request with examples? |
@Globik you can create PR that adds the example to that repository. |
@mhdawson and the sample like this will do? Glib loop in a dedicated thread within nodejs addon N-API: |
nodejs/node#13512 seems to indicate that we should have such an example.
The text was updated successfully, but these errors were encountered: