方法之间延迟 [英] delay betwwen too method

查看:89
本文介绍了方法之间延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,我有一个问题.
我需要在2次执行之间强制延迟15秒.
我怎样才能做到这一点 .谢谢.

hi all , i have a Question .
i need to force 15 seconds delay betwwen 2 mrthod execution .
how can i do this . thanks.

function test(){
method1();
// i want to force delay here
method2();
}
function Method1()
{
// do somthing !
}
function method2()
{
// do somthing !
}

推荐答案

您可以使用普通的javascript
You can use plain javascript
setTimeout(function() { your second _func(); }, 15000);


希望这对您有帮助


Hope this helps


尝试类似的方法:-

Try something like this:-

function test(){
method1();
// i want to force delay here
   setTimeout(function() { Method2() },500) //Set delay time for method 2 appearence
}


function Method1()
{
// do somthing !
}
function method2()
{
// do somthing !
}


function test() {
            Method1();

            setTimeout(function () {
                Method2();
            }, 2000);

            return false;
        }


        function Method1() {
            alert('This is Method 1');
        }
        function Method2() {
            alert('This is Method 2');
        }




这篇关于方法之间延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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