Titanium evalJS slows loading of the webview - timeout waiting to evaluate js

206 views Asked by At

I am developing Titanium application with a webview that is loading content from a remote url. In the load event I am injecting some code with evalJS. Using Titanium SDK 8.0.0+ the loading of the webview content is very slow because of evalJS, I need to wait for some time in order to scroll or click something. I can see in the console that there is a warning repeatedly saying "TiWebViewBinding: (main) [4405,4881] Timeout waiting to evaluate JS", and when this warning stops showing I can interact with the webview. If evalJS is not used meaning I am not injecting code, there is no problem. The webview is loaded properly and there is no warning saying "Timeout waiting to evaluate JS". Before 8.0.0 sdk the problem did not existed. Has anyone had an experience with an issue like this? Am I missing something? I would be very grateful if I get some input on this. Thanks.

    var webview = Ti.UI.createWebView({
        width : Ti.UI.FILL,
        height : Ti.UI.FILL,
        url : "remote url"
    });

    webview.addEventListener('load', function() {
        webview.evalJS('(function() {alert("test");})();');
        webview.evalJS('(function sum(val1, val2){return val1 + val2;})();');

    });

    window.add(webview);
    window.open();
0

There are 0 answers