等到函数完成执行. [英] Wait till function complete execution.

查看:97
本文介绍了等到函数完成执行.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HI ..

HI..

function test()
{
       first();
       second();
       third();

}
 function first(){}
 function second(){}
 function third(){}


我的代码中有这种情况.现在,在第一次和第二次完整执行之前,调用了许多时间函数三.

我希望第三者等到第一和第二完成执行,不要使用延迟.


I have this type of situation in my code. Now, many time function three is called before first and second complete execution.

I want third to wait until first and second finish execution, don''t want to use delay.

推荐答案

我希望第三者等到第一和第二次完成执行,不想使用延迟.
此处:
I want third to wait until first and second finish execution, don''t want to use delay.
Here:
function test()
{       
   first();       
   second();       
   third();
}


默认情况下,它总是同步.因此,只有在第一个完成然后第二个完成之后才执行第三次.

因此,无需使用任何等待/延迟.


By default, it is always synchronous. Thus, third would only be executed after first finishes and then second finishes.

Thus, no need to use any wait/delay.


这篇关于等到函数完成执行.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆