此函数能使js睡眠,将函数贴到代码中即可使用
使用例子:
sleep(5000); //睡眠5秒
function sleep(numberMillis) { var now = new Date(); var exitTime = now.getTime() + numberMillis; while (true) { now = new Date(); if (now.getTime() > exitTime) return; } }
原文出处:
不忘初心_King, 在Js中使程序睡眠的sleep方法, https://blog.csdn.net/qq_33543447/article/details/78337679