MCPcopy Index your code
hub / github.com/nodejs/node-addon-api / DoWork

Method DoWork

test/async_progress_queue_worker.cc:20–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18class TestWorkerWithNoCb : public AsyncProgressQueueWorker<ProgressData> {
19 public:
20 static void DoWork(const CallbackInfo& info) {
21 switch (info.Length()) {
22 case 1: {
23 Function cb = info[0].As<Function>();
24 TestWorkerWithNoCb* worker = new TestWorkerWithNoCb(info.Env(), cb);
25 worker->Queue();
26 } break;
27
28 case 2: {
29 std::string resName = info[0].As<String>();
30 Function cb = info[1].As<Function>();
31 TestWorkerWithNoCb* worker =
32 new TestWorkerWithNoCb(info.Env(), resName.c_str(), cb);
33 worker->Queue();
34 } break;
35
36 case 3: {
37 std::string resName = info[0].As<String>();
38 Object resObject = info[1].As<Object>();
39 Function cb = info[2].As<Function>();
40 TestWorkerWithNoCb* worker =
41 new TestWorkerWithNoCb(info.Env(), resName.c_str(), resObject, cb);
42 worker->Queue();
43 } break;
44
45 default:
46
47 break;
48 }
49 }
50
51 protected:
52 void Execute(const ExecutionProgress& progress) override {

Callers

nothing calls this directly

Calls 3

LengthMethod · 0.80
EnvMethod · 0.80
QueueMethod · 0.80

Tested by

no test coverage detected