[whatwg] HTML extension for system idle detection.

Jens Alfke snej at google.com
Tue Sep 1 16:20:37 PDT 2009


On Aug 31, 2009, at 11:53 PM, Mike Wilson wrote:

> This requirement could be solved in several other ways, f ex making  
> sure that the "standard" timeout period is short enough to not be  
> longer than what any app wants. Then (as was previously suggested)  
> an app that wants a longer timeout can do setTimeout and trigger its  
> own idle stuff if status has not come back to "active" during that  
> time.

This seems reasonable. Different apps really do want different idle- 
time thresholds (if only for compatibility with other manifestations  
of the app, i.e. an IM platform), but I think the event-plus-custom- 
timeout mechanism would let them achieve that.

> Another alternative is to have no event, and just a property:
>     window.lastUserActionTime
> which is kept updated with the "msec since epoch" for the latest  
> user input on the desktop. Then an app can implement its own idle  
> functionality with totally own rules. This API has the drawback of  
> maybe exposing too much information (the rate of input events to  
> other apps), but may spawn some ideas.

This would have to be deliberately fuzzed, as it is apparently  
possible to guess user typing by looking at the timing between  
keystrokes. Rounding it to the nearest second would probably suffice.

The problem with this API is that, once the app determines the user is  
idle, it has to keep polling lastUserActionTime until it sees it  
change. I'm not fond of APIs that require the client to poll.

The best solution, I think, would be both of the above. The  
lastUserActionTime property lets a page test whether the user's  
already idle at the time it loads, and the event lets it detect  
transitions without having to poll.

—Jens

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.whatwg.org/pipermail/whatwg-whatwg.org/attachments/20090901/ada5bca6/attachment-0002.htm>


More information about the whatwg mailing list