Switching between setTimeout function in javascript -


i have settimout function

    settimeout(function(){     //doing here },1000); 

another settimeout func right after above func

window.settimeout(function(){         //code here },10000); 

what need achieve need read files in first settimeout function , processing,once timeout on control should go second timeout function,do stuff there.then first timeout function,do processing there,when timeout on callback second fun , on..like need n number of files.

but whats happening if give loop inside first settimeout fun,it process files , control passed second timeout fun last processed file.but want each file??

how can achieve this?am newbie in javascript. help?

function timeout1() {   console.log("this timeout 1");   window.settimeout(timeout2, 500); }  function timeout2() {   console.log("this timeout 2");   window.settimeout(timeout1, 500); }  // kick off. timeout1(); 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

android - Keyboard hides my half of edit-text and button below it even in scroll view -

css - Make div keyboard-scrollable in jQuery Mobile? -