Sleep function in JavaScript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Leo Smith
    New Member
    • Mar 2007
    • 45

    Sleep function in JavaScript

    Is there a method to put a javascript thread to sleep for a few milliseconds? This would allow for a something to move across the screen on a thread, while still allowing for other actions within the browser to work. I know setInterval can work, but it requires relaunching the functions and writing the values as a global dataset. I would like to know if there is a simple way, that when the action starts, I can pause it without having to create loops or globals.

    Thanks,
    Leo
  • gits
    Recognized Expert Moderator Expert
    • May 2007
    • 5390

    #2
    hi ...

    you may have a look at the:

    [CODE=javascript]window.setTimeo ut(funcref, milliseconds);
    [/CODE]
    method.

    kind regards

    Comment

    Working...