JS是否将Android异步功能视为同步功能

时间:2020-01-13 13:43:39

标签: javascript android asynchronous webview synchronization

我想从Web视图中的服务器获取用户列表。在webview中,我使用android界面调用Android Function来更新列表:

   *dtcStatus = DataDTC[idxDTC].status;
    if (dtcStatus != NULL) {
        return E_OK;
    } else {
        ALOGE("Dem_GetStatusOfDTC return NULL");
        return E_NOT_OK;
    }

<script> var userList; //Passing the task to android and consuming the result in updateUserList() android.syncListWithServer(); //finally consume it in JS alert(userList[0].title); // get Called from android: function updateUserList(data){ userList=data; } </script> 显然是Android中的异步功能(使用改造)。 WebView是否确定目标函数是否异步或将其视为同步函数?换句话说,应用程序是否会被锁定,直到结果从服务器返回,然后转到下一行,否则我将从syncListWithServer()中获取Null?

0 个答案:

没有答案