• Advertisement
Sign in to follow this  

setInterval OR setTimeout: Am I understanding this right?

This topic is 1913 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is this right? We are talking about JavaScript. Event Based Language.


If I use setInterval to call a function every second, and the funtion takes 2 seconds to process. Then I am going to "stack up" requests indefinelty? and creating a longer and longer delay?


If I use setTimeout, and specify 1 second. Then the function will run (again, lets say 2 seconds) and then start the timeout. And not stack up requests.

Share this post


Link to post
Share on other sites
Advertisement
Look here.

Often it will freeze the browser or ignore the next interval until the current one is done.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement