Create example for AsyncProgressWorker & AsyncProgressQueueWorker
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 38/100
- Issue type
- Documentation
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- cpp, nodejs
- Domain
- documentation
Research direction
Start by reading doc/async_worker_variants.md and compare its AsyncProgressWorker and AsyncProgressQueueWorker discussion with the referenced nan test at test/cpp/asyncprogressworker.cpp. Add a complete node-addon-api example and explain how the OnProgress callback arguments select the JavaScript progress callback; done means the example and documentation make that behavior clear.
Written by the indexing model from the issue text.
Description
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 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.
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 new node-addon-api, example/test can be found here: https://github.com/nodejs/nan/blob/e222068f9d99967897a8cefa6c505534b36116ad/test/cpp/asyncprogressworker.cpp
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.
- Dominant language
- C++
- Stars
- 2.6k
- Forks
- 602
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nodejs/node-addon-examples
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 38/100
nodejs/node-addon-examples#585 · 1 reaction ·
-
Difficulty 3/5 1-2 days Newbie friendliness 38/100
nodejs/node-addon-examples#530 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
nodejs/node-addon-examples#445 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 32/100
nodejs/node-addon-examples#444 · 1 comment ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
nodejs/node-addon-examples#381 ·
All issues in nodejs/node-addon-examples
Similar issues
-
Website Doc Typo Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
-
Difficulty 1/5 1-3 hours Newbie friendliness 92/100
autowarefoundation/autoware_universe#13413 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
automated-analysis bug memory-safety
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100