MCPcopy Create free account
hub / github.com/nodejs/node-addon-api / DoWork

Method DoWork

test/async_progress_worker.cc:21–50  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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