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

Method NewInstance

test/cpp/accessors2.cpp:57–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57v8::Local<v8::Value> SetterGetter::NewInstance () {
58 EscapableHandleScope scope;
59 v8::Local<v8::FunctionTemplate> constructorHandle =
60 Nan::New(settergetter_constructor);
61 v8::Local<v8::Object> instance =
62 Nan::NewInstance(Nan::GetFunction(constructorHandle).ToLocalChecked())
63 .ToLocalChecked();
64 SetAccessor(
65 instance
66 , Nan::New("prop1").ToLocalChecked()
67 , SetterGetter::GetProp1);
68 SetAccessor(
69 instance
70 , Nan::New<v8::String>("prop2").ToLocalChecked()
71 , SetterGetter::GetProp2
72 , SetterGetter::SetProp2
73 );
74 return scope.Escape(instance);
75}
76
77NAN_METHOD(SetterGetter::New) {
78 SetterGetter* settergetter = new SetterGetter();

Callers

nothing calls this directly

Calls 6

SetAccessorFunction · 0.85
ToLocalCheckedMethod · 0.80
EscapeMethod · 0.80
NewFunction · 0.50
NewInstanceFunction · 0.50
GetFunctionFunction · 0.50

Tested by

no test coverage detected