MCPcopy Create free account
hub / github.com/nodejs/nan / weakCallback

Function weakCallback

test/cpp/weak.cpp:16–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14static Persistent<v8::Function> cb;
15
16void weakCallback(
17 const WeakCallbackInfo<int> &data) { // NOLINT(runtime/references)
18 HandleScope scope;
19 int *parameter = data.GetParameter();
20 v8::Local<v8::Value> val = New(*parameter);
21 async_resource->runInAsyncScope(
22 GetCurrentContext()->Global(), New(cb), 1, &val);
23 delete async_resource;
24 delete parameter;
25}
26
27v8::Local<v8::String> wrap(v8::Local<v8::Function> func) {
28 EscapableHandleScope scope;

Callers

nothing calls this directly

Calls 5

GetCurrentContextFunction · 0.85
GetParameterMethod · 0.80
runInAsyncScopeMethod · 0.80
NewFunction · 0.50
GlobalMethod · 0.45

Tested by

no test coverage detected