Lines Matching refs:runtime
32 std::string GetLogContent(const shared_ptr<JsRuntime> &runtime, const std::vector<shared_ptr<JsValu… in GetLogContent() argument
36 context += value->ToString(runtime); in GetLogContent()
41 shared_ptr<JsValue> AppDebugLogPrint(const shared_ptr<JsRuntime> &runtime, const shared_ptr<JsValue… in AppDebugLogPrint() argument
44 std::string context = GetLogContent(runtime, argument); in AppDebugLogPrint()
46 return runtime->NewObject(); in AppDebugLogPrint()
49 shared_ptr<JsValue> Setter(const shared_ptr<JsRuntime> &runtime, const shared_ptr<JsValue> &, in Setter() argument
52 std::string context = GetLogContent(runtime, argument); in Setter()
54 return runtime->NewObject(); in Setter()
57 shared_ptr<JsValue> Getter(const shared_ptr<JsRuntime> &runtime, const shared_ptr<JsValue> &, in Getter() argument
60 std::string context = GetLogContent(runtime, argument); in Getter()
62 return runtime->NewObject(); in Getter()
100 TestRuntime runtime; in main() local
102 shared_ptr<JsValue> global = runtime->GetGlobal(); in main()
103 shared_ptr<JsValue> logFunc = runtime->NewFunction(func); in main()
104 shared_ptr<JsValue> consoleObj = runtime->NewObject(); in main()
105 global->SetProperty(*runtime, "console", consoleObj); in main()
106 consoleObj->SetProperty(*runtime, "log", logFunc); in main()
107 consoleObj->SetProperty(*runtime, "info", logFunc); in main()
109 shared_ptr<JsValue> getSetTest = runtime->NewObject(); in main()
110 shared_ptr<JsValue> setter = runtime->NewFunction(Setter); in main()
111 shared_ptr<JsValue> getter = runtime->NewFunction(Getter); in main()
112 bool getset = getSetTest->SetAccessorProperty(*runtime, "GetSetTest", getter, setter); in main()
114 global->SetProperty(*runtime, "GetSet", getSetTest); in main()
117 arguments.emplace_back(runtime->NewString("Hello world")); in main()
119 consoleObj = global->GetProperty(*runtime, "console"); in main()
120 logFunc = consoleObj->GetProperty(*runtime, "log"); in main()
121 shared_ptr<JsValue> testObj = logFunc->Call(*runtime, runtime->NewUndefined(), arguments, 1); in main()
123 shared_ptr<JsValue> testArrayValue = runtime->NewString("1"); in main()
124 shared_ptr<JsValue> testValue = runtime->NewArray(); in main()
125 testValue->SetProperty(*runtime, "0", testArrayValue); in main()
126 testValue->SetProperty(*runtime, "1", testArrayValue); in main()
127 std::cout << "GetProperty test: " << testValue->GetArrayLength(*runtime) << std::endl; in main()
129 testObj->SetProperty(*runtime, "test", testValue); in main()
131 shared_ptr<JsValue> result = testObj->GetProperty(*runtime, "test"); in main()
132 …::cout << "GetProperty test: " << result->IsArray(*runtime) << ";" << result->GetArrayLength(*runt… in main()
136 runtime->ExecuteJsBin("native.aex"); in main()