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

Method DoWork

test/async_worker.cc:83–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

81class TestWorker : public AsyncWorker {
82 public:
83 static void DoWork(const CallbackInfo& info) {
84 bool succeed = info[0].As<Boolean>();
85 Object resource = info[1].As<Object>();
86 Function cb = info[2].As<Function>();
87 Value data = info[3];
88
89 TestWorker* worker = nullptr;
90 if (resource == info.Env().Null()) {
91 worker = new TestWorker(cb, "TestResource");
92 } else {
93 worker = new TestWorker(cb, "TestResource", resource);
94 }
95
96 worker->Receiver().Set("data", data);
97 worker->_succeed = succeed;
98 worker->Queue();
99 }
100
101 protected:
102 void Execute() override {

Callers

nothing calls this directly

Calls 3

EnvMethod · 0.80
SetMethod · 0.80
QueueMethod · 0.80

Tested by

no test coverage detected