Create example for AsyncProgressWorker & AsyncProgressQueueWorker

Offen
#164 4 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Anfängerfreundlichkeit
38/100
Issue-Typ
Dokumentation
Klarheit
Größtenteils klar
Aktivitätsstatus
Veraltet
Tech-Stack
cpp, nodejs
Bereich
documentation

Rechercherichtung

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.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
C++
Sterne
2.6k
Forks
598
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus nodejs/node-addon-examples

Alle Issues in nodejs/node-addon-examples

Ähnliche Issues

Weitere Issues zu C++

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.