Quantcast
Channel: Appcelerator Developer Center Q&A Tag Feed (webview)
Viewing all articles
Browse latest Browse all 680

one load event trigger both WebView event

$
0
0

Environment: mac Titatium ios

i had created two WebView in a window when the WebView loaded, every WebView transfer data to Html'js to draw a chart. however, only one WebView can draw a chart, another WebView noticed that find can't the html's js code.

we guess: when a WebView is loaded , it will trigger both load event of the WebView. code is like that: chartFactory = new WebViewFactory 'lineChart.html',80 chartWebView = chartFactory.getWebView() @mainView.add chartWebView chartWebView "load",(e): chartWebView.drawChart data // drawChart method will call the html's js function to draw line pieFactory = new WebViewFactory 'pieChart.html',300 pieWebView = pieFactory.getWebView() @mainView.add pieWebView pieWebView "load",(e): pieWebView.drawPie data // drawPie method will call the html's js function to draw pie

the result: i only get a picture of line, but warning that can't find the drawPie function int the html.(i ensure that it exists, i try to use draw each picture (line or pie), it is ok.)

if i add some alert in the drawPie method, it will stop the second load function,sometimes the result is correct, and the both pic can be showed.

whether is did had the problem?


Viewing all articles
Browse latest Browse all 680

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>