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

Nan:AsyncProgressWorker equivalent? #473

Closed
JipBoesenkool opened this issue Apr 20, 2019 · 4 comments
Closed

Nan:AsyncProgressWorker equivalent? #473

JipBoesenkool opened this issue Apr 20, 2019 · 4 comments

Comments

@JipBoesenkool
Copy link

@jasongin could you reply to @ptgolden's question? I can find neither node-addon-api or n-api functions to implement streaming worker such as Nan::AsyncProgressWorker

There is example of usage from a book: [factorization example | https://github.com/freezer333/nodecpp-demo/blob/master/streaming/examples/factorization/factorization.js].

In my case I need to hook some system events and pass them to js callback.

Originally posted by @gorshkov-leonid in #75 (comment)

@JipBoesenkool
Copy link
Author

I have exactly the same use case as @gorshkob-leanid

@mhdawson
Copy link
Member

@JipBoesenkool have you looked at the https://nodejs.org/api/n-api.html#n_api_asynchronous_thread_safe_function_calls as an option? Not sure if that will work for your use case but worth a look.

@gorshkov-leonid
Copy link

I tried napi and it, it works. But it looks redundantly. Nan API is much more convenient in this case.

@gorshkov-leonid
Copy link

gorshkov-leonid commented May 18, 2019

To clarify case, I use system hook with own callback. So I need to pass values from this callback to js side. The code might be not pretty, because I have to recall(=learn) c++ basis after ages of oblivion:

https://github.com/gorshkov-leonid/node-native-addons-example/blob/master/native-addon-hooker/hooker.cc

gorshkov-leonid added a commit to gorshkov-leonid/node-native-addons-example that referenced this issue Dec 3, 2021
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this issue Aug 24, 2022
PR-URL: nodejs/node-addon-api#529
Fixes: nodejs/node-addon-api#473
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this issue Aug 26, 2022
PR-URL: nodejs/node-addon-api#529
Fixes: nodejs/node-addon-api#473
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this issue Sep 19, 2022
PR-URL: nodejs/node-addon-api#529
Fixes: nodejs/node-addon-api#473
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this issue Aug 11, 2023
PR-URL: nodejs/node-addon-api#529
Fixes: nodejs/node-addon-api#473
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants