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
It doesn't really explain how to use the progress callback in the OnProgress function...just randomly makes a Callback().Call({Env().Null(), Env().Null(), Number::New(Env(), *data)}); call with two Env().Null()'s with no explanation as to what this is doing. I guess by passing two nulls it forces this to the Progress callback in javascript...but it's all a bit confusing.
I am porting a project from nan -> node-addon-api currently, and feel an example on how the progress callbacks work would be beneficial to me and others also.
Thanks.
The text was updated successfully, but these errors were encountered:
Seems like the documentation is wrong and out of date possibly. Makes more sense now that I see two Function's being passed. Still think an example in this repo would not hurt.
I have gone ahead and created a PR to clean up the documentation. Maybe later if I get some extra time I will convert this into a proper example here as well (or someone else can feel free to if they wish as well).
There is currently on example for these progress workers. The documentation is kind of a bit confusing here: https://github.com/nodejs/node-addon-api/blob/master/doc/async_worker_variants.md
It doesn't really explain how to use the progress callback in the
OnProgress
function...just randomly makes aCallback().Call({Env().Null(), Env().Null(), Number::New(Env(), *data)});
call with twoEnv().Null()
's with no explanation as to what this is doing. I guess by passing two nulls it forces this to the Progress callback in javascript...but it's all a bit confusing.Would be nice to get a proper example on here put together for these progressworkers. In the
nan
library you have to specify each the callback and the progresscallback to the worker, but it doesn't seem to be the case in the newnode-addon-api
, example/test can be found here: https://github.com/nodejs/nan/blob/e222068f9d99967897a8cefa6c505534b36116ad/test/cpp/asyncprogressworker.cppI am porting a project from
nan
->node-addon-api
currently, and feel an example on how the progress callbacks work would be beneficial to me and others also.Thanks.
The text was updated successfully, but these errors were encountered: