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

Function RunInCallbackScopeFromExisting

test/callbackscope.cc:16–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14}
15
16static void RunInCallbackScopeFromExisting(const CallbackInfo& info) {
17 Function callback = info[0].As<Function>();
18 Env env = info.Env();
19
20 AsyncContext ctx(env, "existing_callback_scope_test");
21 napi_callback_scope scope;
22 napi_open_callback_scope(env, Object::New(env), ctx, &scope);
23
24 CallbackScope existingScope(env, scope);
25 assert(existingScope.Env() == env);
26
27 callback.Call({});
28}
29
30} // namespace
31

Callers

nothing calls this directly

Calls 2

EnvMethod · 0.80
CallMethod · 0.80

Tested by

no test coverage detected