By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,567 Members | 1,185 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,567 IT Pros & Developers. It's quick & easy.

setTimeout - does it reset when the mouse is moved?

P: n/a
How does setTimeout work? If the user moves the mouse or types some text
into a form, does it reset the timer? Or does it start running when first
triggered and simply timeout after that amount of time?

For example, if the timeout is set to 5 minutes and after 4.5 mins, the user
moves the mouse over the screen, does the timer reset to 5 mins or will it
still timeout after another 30 seconds?

Cheers, Rob.
Oct 3 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 03/10/2005 12:07, Rob Nicholson wrote:
How does setTimeout work? If the user moves the mouse or types some text
into a form, does it reset the timer? Or does it start running when first
triggered and simply timeout after that amount of time?


The latter. It simply executes code - either a string containing
statements or a function reference[1] - after a specified number of
milliseconds[2].

[snip]

Mike
[1] See the FAQ for notes on the using a function reference.

<URL:http://www.jibbering.com/faq/faq_notes/misc.html#mtSetTI>

[2] In reality, the delay is only an approximation. Windows 9x,
for instance, only has a resolution of 55 milliseconds, so
accuracy is far from guaranteed.

<URL:http://www.merlyn.demon.co.uk/js-date0.htm#TaI>

--
Michael Winter
Prefix subject with [News] before replying by e-mail.
Oct 3 '05 #2

P: n/a

Well, setTimeout() is oblivious to any event unless the event has a
functino bound that clears it out, otherwise, it's timing moves on
regardless of events, if you gave it 300000ms, it'll execute 5mins from
runtime launch undeterred.
Danny
Oct 4 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.