此函数能使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;
}
}
此函数能使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;
}
}