在几个ajax请求期间,在某个时间段调用依赖函数。我的问题是,有什么方法可以在没有使用settimeout函数中的事件的情况下查找总时间段(200 + 300 + 500)。多个settimeout调用的时间段计数
//main ajax calls using following functions
setTimeout(function(){
avg(10,15,30);
alert('I am triggered at 2ms');//dependant function 1 (calculate avg)
},200);
setTimeout(function(){
total(50,100,30);
alert('I am triggered at 3ms');//df 2(calculate total)
},300);
setTimeout(function(){
vat_cal(180,12.5);
alert('I am triggered at 5ms');//df 3(calculate vat % for total)
},500);
假设我不知道setTimeout使用了多少次。 因此,如果时间因素已知,则可以更轻松地通过通知加载数据。
多个ajax请求正在查杀数据加载时间。如果我知道总时间(200 + 300 + 500 = 1000)。我可以通知用户等待一秒钟。
我不知道你想描述一下。你能举一个更具体的例子说明你正在做什么? – JLRishe 2014-12-03 06:38:57
请您详细说明您的问题.. – 2014-12-03 06:42:55