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

Method createConsole

test-app/runtime/src/main/cpp/console/Console.cpp:22–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

20namespace tns {
21
22v8::Local<v8::Object> Console::createConsole(v8::Local<v8::Context> context, ConsoleCallback callback, const int maxLogcatObjectSize, const bool forceLog) {
23 m_callback = callback;
24 m_maxLogcatObjectSize = maxLogcatObjectSize;
25 v8::Context::Scope contextScope(context);
26 v8::Isolate* isolate = context->GetIsolate();
27
28 v8::Local<v8::Object> console = v8::Object::New(isolate);
29 bool success = console->SetPrototype(context, v8::Object::New(isolate)).FromMaybe(false);
30
31 assert(success);
32
33 std::map<std::string, double> timersMap;
34 Console::s_isolateToConsoleTimersMap.insert(std::make_pair(context->GetIsolate(), timersMap));
35
36 bindFunctionProperty(context, console, "assert", assertCallback);
37 bindFunctionProperty(context, console, "error", errorCallback);
38 bindFunctionProperty(context, console, "info", infoCallback);
39 bindFunctionProperty(context, console, "log", logCallback);
40 bindFunctionProperty(context, console, "warn", warnCallback);
41 bindFunctionProperty(context, console, "dir", dirCallback);
42 bindFunctionProperty(context, console, "trace", traceCallback);
43 bindFunctionProperty(context, console, "time", timeCallback);
44 bindFunctionProperty(context, console, "timeEnd", timeEndCallback);
45
46 return console;
47}
48
49void Console::sendToADBLogcat(const std::string& message, android_LogPriority logPriority) {
50 // limit the size of the message that we send to logcat using the predefined value in package.json

Callers

nothing calls this directly

Calls 4

NewFunction · 0.85
GetIsolateMethod · 0.45
FromMaybeMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected