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

Method NAN_METHOD

test/cpp/wrappedobjectfactory.cpp:36–49  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34 ~InnerObject() {}
35
36 static NAN_METHOD(New) {
37 if (info.IsConstructCall()) {
38 double value = info[0]->IsNumber() ? To<double>(info[0]).FromJust() : 0;
39 InnerObject * obj = new InnerObject(value);
40 obj->Wrap(info.This());
41 info.GetReturnValue().Set(info.This());
42 } else {
43 const int argc = 1;
44 v8::Local<v8::Value> argv[argc] = {info[0]};
45 v8::Local<v8::Function> cons = Nan::New(constructor());
46 info.GetReturnValue().Set(
47 Nan::NewInstance(cons, argc, argv).ToLocalChecked());
48 }
49 }
50
51 static NAN_METHOD(GetValue) {
52 InnerObject* obj = ObjectWrap::Unwrap<InnerObject>(info.Holder());

Callers

nothing calls this directly

Calls 7

FromJustMethod · 0.80
WrapMethod · 0.80
ToLocalCheckedMethod · 0.80
NewFunction · 0.50
NewInstanceFunction · 0.50
SetMethod · 0.45
GetReturnValueMethod · 0.45

Tested by

no test coverage detected