My simple app has to run a small JS in a Web View. It works when calling it from a button but it doesn't work when ran from a thread. Does the Web View require to be accessed in something like a main loop? I cannot find anything on this in C. I need to run in main thread/ UI thread in iOS but I cannot find any information on this for Tizen.
static void
create_base_gui(appdata_s *ad)
{
pthread_t tid;
pthread_create(&tid, NULL, &checker, NULL);
void scriptCallback(Evas_Object* o, const char* result_value, void* user_data) {
dlog_print(DLOG_DEBUG, "AAAMYTAG", "scriptCallback %s", result_value);
}
void *checker(void *arg)
{
while(true)
{
COUNTER++;
runJS();
sleep(5);
}
return 0;
}
void runJS() {
const char scripts[]="function test() { return 'test'; }; test();";
void (*cb_test)(Evas_Object*, const char*, void*) = scriptCallback;
ewk_view_script_execute(amg->web_view, scripts, cb_test, NULL); //doesnt do anything
}
static void
btn_prev_cb(void *data, Evas_Object *obj, void *event_info){
const char scripts[]="function test() { return 'test'; }; test();";
void (*cb_test)(Evas_Object*, const char*, void*) = scriptCallback;
ewk_view_script_execute(amg->web_view, scripts, cb_test, NULL); //works perfectly fine
}
Thank you