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

Function NAN_MODULE_INIT

test/cpp/strings.cpp:37–77  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

35Persistent<v8::FunctionTemplate> encodeUCS2_persistent;
36
37NAN_MODULE_INIT(Init) {
38 v8::Local<v8::FunctionTemplate> returnUtf8String =
39 New<v8::FunctionTemplate>(ReturnUtf8String);
40
41 returnUtf8String_persistent.Reset(returnUtf8String);
42
43 Set(target
44 , New("returnUtf8String").ToLocalChecked()
45 , GetFunction(returnUtf8String).ToLocalChecked()
46 ).FromJust();
47
48 v8::Local<v8::FunctionTemplate> heapString =
49 New<v8::FunctionTemplate>(HeapString);
50
51 heapString_persistent.Reset(heapString);
52
53 Set(target
54 , New("heapString").ToLocalChecked()
55 , GetFunction(heapString).ToLocalChecked()
56 ).FromJust();
57
58 v8::Local<v8::FunctionTemplate> encodeHex =
59 New<v8::FunctionTemplate>(EncodeHex);
60
61 encodeHex_persistent.Reset(encodeHex);
62
63 Set(target
64 , New("encodeHex").ToLocalChecked()
65 , GetFunction(encodeHex).ToLocalChecked()
66 ).FromJust();
67
68 v8::Local<v8::FunctionTemplate> encodeUCS2 =
69 New<v8::FunctionTemplate>(EncodeUCS2);
70
71 encodeUCS2_persistent.Reset(encodeUCS2);
72
73 Set(target
74 , New("encodeUCS2").ToLocalChecked()
75 , GetFunction(encodeUCS2).ToLocalChecked()
76 ).FromJust();
77}
78
79NODE_MODULE(strings, Init)

Callers

nothing calls this directly

Calls 6

FromJustMethod · 0.80
ToLocalCheckedMethod · 0.80
SetFunction · 0.50
NewFunction · 0.50
GetFunctionFunction · 0.50
ResetMethod · 0.45

Tested by

no test coverage detected