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

Method DoWorkWithAsyncRes

test/async_worker.cc:162–176  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160 }
161
162 static Value DoWorkWithAsyncRes(const CallbackInfo& info) {
163 napi_env env = info.Env();
164 bool succeed = info[0].As<Boolean>();
165 Object resource = info[1].As<Object>();
166
167 TestWorkerNoCallback* worker = nullptr;
168 if (resource == info.Env().Null()) {
169 worker = new TestWorkerNoCallback(env, "TestResource");
170 } else {
171 worker = new TestWorkerNoCallback(env, "TestResource", resource);
172 }
173 worker->_succeed = succeed;
174 worker->Queue();
175 return worker->_deferred.Promise();
176 }
177
178 protected:
179 void Execute() override {}

Callers

nothing calls this directly

Calls 3

EnvMethod · 0.80
QueueMethod · 0.80
PromiseMethod · 0.80

Tested by

no test coverage detected