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

Function SetCastedObjects

test/object_reference.cc:222–239  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

220}
221
222void SetCastedObjects(const CallbackInfo& info) {
223 Env env = info.Env();
224 HandleScope scope(env);
225
226 Array ex = Array::New(env);
227 ex.Set((uint32_t)0, String::New(env, "hello"));
228 ex.Set(1, String::New(env, "world"));
229 ex.Set(2, String::New(env, "!"));
230
231 casted_weak = Weak(ex.As<Object>());
232 casted_weak.SuppressDestruct();
233
234 casted_persistent = Persistent(ex.As<Object>());
235 casted_persistent.SuppressDestruct();
236
237 casted_reference = Reference<Object>::New(ex.As<Object>(), 2);
238 casted_reference.SuppressDestruct();
239}
240
241// info[0] is a flag to determine if the weak, persistent, or
242// multiple reference ObjectReference is being requested.

Callers

nothing calls this directly

Calls 5

WeakFunction · 0.85
PersistentFunction · 0.85
EnvMethod · 0.80
SetMethod · 0.80
SuppressDestructMethod · 0.80

Tested by

no test coverage detected