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
{{ message }}
Repository navigation
Create example for AsyncProgressWorker & AsyncProgressQueueWorker #164
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.
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).
Activity
mastergberry commentedon Nov 4, 2020
Upon a bit of further inspection of the source code, I found a similar test which shows something that makes more sense on how to use the async progress workers: nodejs/node-addon-api@ab01844#diff-3f536315f565c436ece66924a9d8073b7e0aa43366dedf4cda5ac9ac1a1e991eR18
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.mhdawson commentedon Nov 5, 2020
@mastergberry any chance you would want to submit a PR to fix the documentation?
mastergberry commentedon Nov 6, 2020
Hey @mhdawson
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).
nodejs/node-addon-api#831
mhdawson commentedon Nov 9, 2020
@mastergberry thanks for doing that. PR is landed :)