MCPcopy Create free account
hub / github.com/NativeScript/android / Init

Method Init

test-app/runtime/src/main/cpp/ArrayHelper.cpp:14–35  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

12}
13
14void ArrayHelper::Init(const Local<Context>& context) {
15 JEnv env;
16
17 RUNTIME_CLASS = env.FindClass("com/tns/Runtime");
18 assert(RUNTIME_CLASS != nullptr);
19
20 CREATE_ARRAY_HELPER = env.GetStaticMethodID(RUNTIME_CLASS, "createArrayHelper", "(Ljava/lang/String;I)Ljava/lang/Object;");
21 assert(CREATE_ARRAY_HELPER != nullptr);
22
23 auto isolate = context->GetIsolate();
24 auto global = context->Global();
25 auto arr = global->Get(context, ArgConverter::ConvertToV8String(isolate, "Array"));
26
27 if (!arr.IsEmpty()) {
28 Local<Value> arrVal;
29 auto success = arr.ToLocal(&arrVal);
30 if (success) {
31 auto arrayObj = arrVal.As<Object>();
32 arrayObj->Set(context, ArgConverter::ConvertToV8String(isolate, "create"), FunctionTemplate::New(isolate, CreateJavaArrayCallback)->GetFunction(context).ToLocalChecked());
33 }
34 }
35}
36
37void ArrayHelper::CreateJavaArrayCallback(const FunctionCallbackInfo<Value>& info) {
38 try {

Callers

nothing calls this directly

Calls 11

NewFunction · 0.85
GetStaticMethodIDMethod · 0.80
ToLocalMethod · 0.80
ToLocalCheckedMethod · 0.80
GetFunctionMethod · 0.80
FindClassMethod · 0.45
GetIsolateMethod · 0.45
GlobalMethod · 0.45
GetMethod · 0.45
IsEmptyMethod · 0.45
SetMethod · 0.45

Tested by

no test coverage detected