asynchronous - Javascript: Trying to load highcharts without freezing the browser -
i need load n graphs, instead of waiting 1 min browser frozen, 1 time first graph created / rendered, appears on screen before moving next one.
i using "strategy" works in part of code, why not working here?
the code:
var = -1; var total = 10; function movetothenext() { saysomething() .then(function() {return $timeout(function(){},1000);}) .then(nextchart()); } function saysomething() { console.log('hey') var deferred = $q.defer(); deferred.resolve(); homecoming deferred.promise; } function nextchart() { i++; if (i <= total) { // stuff chart[i] = new highcharts.chart({ //.... },movetothenext()); } }
update error in execution of nextchart function
function movetothenext() { saysomething() .then(function() {return $timeout(function(){},1000);}) .then(function() {nextchart();}); }
now works :)
solved, see updated code in question
javascript asynchronous highcharts
No comments:
Post a Comment