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

Function asyncProgressWorkerCallbackOverloads

test/async_progress_worker.js:31–57  ·  view source on GitHub ↗
(bindingFunction)

Source from the content-addressed store, hash-verified

29}
30
31async function asyncProgressWorkerCallbackOverloads (bindingFunction) {
32 bindingFunction(common.mustCall());
33 if (!checkAsyncHooks()) {
34 return;
35 }
36
37 const hooks = common.installAysncHooks('cbResources');
38
39 const triggerAsyncId = asyncHooks.executionAsyncId();
40 await new Promise((resolve, reject) => {
41 bindingFunction(common.mustCall(), 'cbResources');
42 hooks.then(actual => {
43 assert.deepStrictEqual(actual, [
44 {
45 eventName: 'init',
46 type: 'cbResources',
47 triggerAsyncId,
48 resource: {}
49 },
50 { eventName: 'before' },
51 { eventName: 'after' },
52 { eventName: 'destroy' }
53 ]);
54 }).catch(common.mustNotCall());
55 resolve();
56 });
57}
58
59async function asyncProgressWorkerRecvOverloads (bindingFunction) {
60 const recvObject = {

Callers 1

testFunction · 0.70

Calls 1

checkAsyncHooksFunction · 0.70

Tested by 1

testFunction · 0.56