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

Function NAN_MODULE_INIT

test/cpp/makecallback.cpp:37–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35}
36
37NAN_MODULE_INIT(MyObject::Init) {
38 // Prepare constructor template
39 v8::Local<v8::FunctionTemplate> tpl = Nan::New<v8::FunctionTemplate>(New);
40 tpl->SetClassName(Nan::New<v8::String>("MyObject").ToLocalChecked());
41 tpl->InstanceTemplate()->SetInternalFieldCount(1);
42
43 SetPrototypeMethod(tpl, "call_emit", CallEmit);
44
45 v8::Local<v8::Function> function = GetFunction(tpl).ToLocalChecked();
46 constructor.Reset(function);
47 Set(target, Nan::New("MyObject").ToLocalChecked(), function);
48}
49
50NAN_METHOD(MyObject::New) {
51 if (info.IsConstructCall()) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected