[whatwg] 7.3 Timers

Alexandre Morgaut Alexandre.Morgaut at 4d.com
Tue Mar 1 01:37:23 PST 2011


On Feb 28, 2011, at 8:19 PM, Boris Zbarsky wrote:

>> 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

Thanks for highlighting that, I see it more clearly 

By the way I still don't see it in the process, I only see:
- the "get the timed task handle" step
- and the "get the timeout" step


>> 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.

I agree this is  a problem for the listed use cases

This is another good reason:
- to use a different method name for this purpose
- to provide a better solution to these needs

I'm not sure which one could be either correct and intuitive

 - scheduleTask() ?
 - setTaskDate() ?
 - setCron() ?

anything else ?

The question would be, if the computer goes to sleep, should the user agent :
1 - wake up the computer to execute the function ?
2 - wait until it wake up to execute it ?
3 - ignore the handler if its to late ?

The choice between options 2 and 3, could be settable as part of the method signature.

The first option looks more sensible and in my opinion should require to activate a setting or ask the user to accept for the current domain




This show up another requirement

As for a Web "Application", User Agents may provide a setting dialog so it could ask to the user to accept a list of option for the application
This way, the user won't miss line on top of the page asking authorizations for each ones

Example:

setDomainSettings( message, required, optional);

where "required" and "optional"  parameters would expect a list of options to activate including:

- geolocation
- storage with specific size
- crons
- allow popup
- remember password

Thoughts ?

Alexandre.



More information about the whatwg mailing list