[whatwg] 7.3 Timers

Boris Zbarsky bzbarsky at MIT.EDU
Mon Feb 28 11:19:17 PST 2011

On 2/28/11 2:13 PM, Alexandre Morgaut wrote:
> When I read: Any arguments are passed straight through to the handler.
> I wonder if it does not mean that I should pass one parameter per argument to pass to the handler
> ->  setTimeout( myhandler, 1000, arg1, arg2, arg3);


> But well, the signature looks like there is only one parameter

No.  If there were only one parameter, the signature would say |in any 
args|.  It actually says |in any... args| which means any number of 
arguments.  See http://www.w3.org/TR/WebIDL/#dfn-variadic-operation

> But couldn't setTimeout() accept natively a Date object in place of the timeout parameter

Note that if you set a timeout for 1 hour from now, and then the 
computer goes to sleep for 3 hours, then the timeout will fire 1 hour 
after the computer wakes up, not immediately on wakeup.

So if you're depending on setTimeout to fire at particular wall-clock 
times, don't.  It won't.


More information about the whatwg mailing list