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

Method Initialize

test/objectwrap_function.cc:21–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

19 }
20
21 static void Initialize(Napi::Env env, Napi::Object exports) {
22 const char* name = "FunctionTest";
23 Napi::Function func = DefineClass(env, name, {});
24 Napi::FunctionReference* ctor = new Napi::FunctionReference();
25 *ctor = Napi::Persistent(func);
26 env.SetInstanceData(ctor);
27 exports.Set(name, func);
28 }
29
30 static Napi::Function GetConstructor(Napi::Env env) {
31 return env.GetInstanceData<Napi::FunctionReference>()->Value();

Callers

nothing calls this directly

Calls 3

PersistentFunction · 0.85
SetInstanceDataMethod · 0.80
SetMethod · 0.80

Tested by

no test coverage detected