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

Function NAN_MODULE_INIT

test/cpp/accessors.cpp:44–67  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44NAN_MODULE_INIT(SetterGetter::Init) {
45 v8::Local<v8::FunctionTemplate> tpl =
46 Nan::New<v8::FunctionTemplate>(SetterGetter::New);
47 settergetter_constructor.Reset(tpl);
48 tpl->SetClassName(Nan::New<v8::String>("SetterGetter").ToLocalChecked());
49 tpl->InstanceTemplate()->SetInternalFieldCount(1);
50 SetPrototypeMethod(tpl, "log", SetterGetter::Log);
51 v8::Local<v8::ObjectTemplate> itpl = tpl->InstanceTemplate();
52 SetAccessor(
53 itpl
54 , Nan::New("prop1").ToLocalChecked()
55 , SetterGetter::GetProp1);
56 SetAccessor(
57 itpl
58 , Nan::New<v8::String>("prop2").ToLocalChecked()
59 , SetterGetter::GetProp2
60 , SetterGetter::SetProp2
61 );
62
63 v8::Local<v8::Function> createnew =
64 Nan::GetFunction(
65 Nan::New<v8::FunctionTemplate>(CreateNew)).ToLocalChecked();
66 Set(target, Nan::New<v8::String>("create").ToLocalChecked(), createnew);
67}
68
69v8::Local<v8::Value> SetterGetter::NewInstance () {
70 EscapableHandleScope scope;

Callers

nothing calls this directly

Calls 7

SetPrototypeMethodFunction · 0.85
SetAccessorFunction · 0.85
ToLocalCheckedMethod · 0.80
NewFunction · 0.50
GetFunctionFunction · 0.50
SetFunction · 0.50
ResetMethod · 0.45

Tested by

no test coverage detected