Javascript - Sleep


/ Published in: JavaScript



Copy this code and paste it in your HTML
  1. function pause(millisecondi)
  2. {
  3. var now = new Date();
  4. var exitTime = now.getTime() + millisecondi;
  5.  
  6. while(true)
  7. {
  8. now = new Date();
  9. if(now.getTime() > exitTime) return;
  10. }
  11. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.