Posted By

abhiomkar on 12/22/09


Tagged

javascript delay sleep wait


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

matpolster


Sleep/Delay in Javascript


 / Published in: JavaScript
 

  1. function sleep(delay)
  2. {
  3. var start = new Date().getTime();
  4. while (new Date().getTime() < start + delay);
  5. }
  6.  
  7. //usage
  8. //wait for 3 seconds
  9. sleep(3000);

Report this snippet  

You need to login to post a comment.