//同步流程 var series=function(arr){ function async(i){ arr[i](function(){ if(1+i<arr.length){ async(1+i) } }) } async(0) } //demo var back1=function(callback){ setTimeout(function(){ cc.log(21) callback() },1000) } series([back1,back1,back1])
//同步流程 var series=function(arr){ function async(i){ arr[i](function(){ if(1+i<arr.length){ async(1+i) } }) } async(0) } //demo var back1=function(callback){ setTimeout(function(){ cc.log(21) callback() },1000) } series([back1,back1,back1])