js暂停的函数

// numberMillis 毫秒
function sleep(numberMillis) {
   var now = new Date();
   var exitTime = now.getTime() + numberMillis;
   while (true) {
      now = new Date();
      if (now.getTime() > exitTime)
        return;
      }
   }

 

posted @ 2016-10-29 15:00  jamess  阅读(10822)  评论(0编辑  收藏  举报