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

Function AddFinalizerWithHint

test/object/finalizer.cc:19–30  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19Value AddFinalizerWithHint(const CallbackInfo& info) {
20 ObjectReference* ref = new ObjectReference;
21 *ref = Persistent(Object::New(info.Env()));
22 info[0].As<Object>().AddFinalizer(
23 [](Napi::Env /*env*/, ObjectReference* ref, int* dummy_p) {
24 ref->Set("finalizerCalledWithCorrectHint", dummy_p == &dummy);
25 delete ref;
26 },
27 ref,
28 &dummy);
29 return ref->Value();
30}

Callers

nothing calls this directly

Calls 5

PersistentFunction · 0.85
EnvMethod · 0.80
AddFinalizerMethod · 0.80
SetMethod · 0.80
ValueMethod · 0.80

Tested by

no test coverage detected