Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


setInterval OR setTimeout: Am I understanding this right?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Schoening   Members   -  Reputation: 141

Like
0Likes
Like

Posted 29 October 2012 - 02:02 AM

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.

Sponsor:

#2 kd7tck   Members   -  Reputation: 715

Like
0Likes
Like

Posted 29 October 2012 - 02:47 AM

Look here.

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

#3 Schoening   Members   -  Reputation: 141

Like
0Likes
Like

Posted 29 October 2012 - 05:36 AM

So this is a yes for setTimeout?




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS