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

Method CreateWork

test/async_progress_queue_worker.cc:172–181  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

170class TestWorker : public AsyncProgressQueueWorker<ProgressData> {
171 public:
172 static Napi::Value CreateWork(const CallbackInfo& info) {
173 int32_t times = info[0].As<Number>().Int32Value();
174 Function cb = info[1].As<Function>();
175 Function progress = info[2].As<Function>();
176
177 TestWorker* worker = new TestWorker(
178 cb, progress, "TestResource", Object::New(info.Env()), times);
179
180 return Napi::External<TestWorker>::New(info.Env(), worker);
181 }
182
183 static void QueueWork(const CallbackInfo& info) {
184 auto wrap = info[0].As<Napi::External<TestWorker>>();

Callers

nothing calls this directly

Calls 1

EnvMethod · 0.80

Tested by

no test coverage detected