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

Function InitFunction

test/function.cc:229–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227} // end anonymous namespace
228
229Object InitFunction(Env env) {
230 Object result = Object::New(env);
231 Object exports = Object::New(env);
232 exports["emptyConstructor"] = Function::New(env, EmptyConstructor);
233 exports["voidCallback"] = Function::New(env, VoidCallback, "voidCallback");
234 exports["valueCallback"] =
235 Function::New(env, ValueCallback, std::string("valueCallback"));
236 exports["voidCallbackWithData"] =
237 Function::New(env, VoidCallbackWithData, nullptr, &testData);
238 exports["valueCallbackWithData"] =
239 Function::New(env, ValueCallbackWithData, nullptr, &testData);
240 exports["newTargetCallback"] =
241 Function::New(env, NewTargetCallback, std::string("newTargetCallback"));
242 exports["callWithArgs"] = Function::New(env, CallWithArgs);
243 exports["callWithVector"] = Function::New(env, CallWithVector);
244 exports["callWithVectorUsingCppWrapper"] =
245 Function::New(env, CallWithVectorUsingCppWrapper);
246 exports["callWithCStyleArray"] = Function::New(env, CallWithCStyleArray);
247 exports["callWithReceiverAndCStyleArray"] =
248 Function::New(env, CallWithReceiverAndCStyleArray);
249 exports["callWithReceiverAndArgs"] =
250 Function::New(env, CallWithReceiverAndArgs);
251 exports["callWithReceiverAndVector"] =
252 Function::New(env, CallWithReceiverAndVector);
253 exports["callWithReceiverAndVectorUsingCppWrapper"] =
254 Function::New(env, CallWithReceiverAndVectorUsingCppWrapper);
255 exports["callWithInvalidReceiver"] =
256 Function::New(env, CallWithInvalidReceiver);
257 exports["callConstructorWithArgs"] =
258 Function::New(env, CallConstructorWithArgs);
259 exports["callConstructorWithVector"] =
260 Function::New(env, CallConstructorWithVector);
261 exports["callConstructorWithCStyleArray"] =
262 Function::New(env, CallConstructorWithCStyleArray);
263 exports["isConstructCall"] = Function::New(env, IsConstructCall);
264 exports["makeCallbackWithArgs"] = Function::New(env, MakeCallbackWithArgs);
265 exports["makeCallbackWithVector"] =
266 Function::New(env, MakeCallbackWithVector);
267 exports["makeCallbackWithCStyleArray"] =
268 Function::New(env, MakeCallbackWithCStyleArray);
269 exports["makeCallbackWithInvalidReceiver"] =
270 Function::New(env, MakeCallbackWithInvalidReceiver);
271 exports["callWithFunctionOperator"] =
272 Function::New(env, CallWithFunctionOperator);
273 result["plain"] = exports;
274
275 exports = Object::New(env);
276 exports["emptyConstructor"] = Function::New(env, EmptyConstructor);
277 exports["voidCallback"] = Function::New<VoidCallback>(env, "voidCallback");
278 exports["valueCallback"] =
279 Function::New<ValueCallback>(env, std::string("valueCallback"));
280 exports["newTargetCallback"] =
281 Function::New<NewTargetCallback>(env, std::string("newTargetCallback"));
282 exports["voidCallbackWithData"] =
283 Function::New<VoidCallbackWithData>(env, nullptr, &testData);
284 exports["valueCallbackWithData"] =
285 Function::New<ValueCallbackWithData>(env, nullptr, &testData);
286 exports["callWithArgs"] = Function::New<CallWithArgs>(env);

Callers 1

InitFunction · 0.85

Calls 1

EnvMethod · 0.80

Tested by

no test coverage detected