HTML extension for system idle detection.

I have a proposal for an extension to javascript to enable browsers to
access system idle information.  Please give me feedback and suggestions on
the proposal.

Thanks!

SUMMARY

There currently is no way to detect the system idle state in the browser.
 For example this makes it difficult to deal with any sort of chat room or
instant messaging client inside the browser since the idle will always be
incorrect; or allow for apps to control their speed or network resources
when a user is idle.

USE CASE

Any instant messaging client, or any client that requires user presence,
will use this to keep track of the users idle state.  Currently the idle
state of a user inside a browser tell tend to be incorrect, and this leads
to problems with people being unable to rely on the available status of a
user.  Without this information it is difficult to do a full featured and
reliable instant messaging client inside the browser since this makes the
users' status somewhat unreliable.

Lots of social networking sites and other sites centered around user
interactions on the net keep track of the users idle state for enabling
interactions with people that are currently online, this would be especially
useful for interactive online gaming.

A process that would like to do some heavy duty processing, like seti@home,
could use the system idle detection to enable the processing only when the
user is idle and enable it to not interfere with or degrade their normal
browsing experience.

Any process that is often querying the server backend, like gmail or
facebook, could opt to do fewer server updates while the user is idle to
reduce the network traffic and load on their backend servers.

A web app could use this time to garbage collect and/or sync information
with a localstorage/database so as to not pause the user experience when not
idle.

WORK AROUNDS

The idle state of the user is currently detected by looking at the browser
window and detecting the last activity time for the window.  This is
inaccurate since if the user is not looking at the page the state will be
incorrect and means that the idle time is set to longer than would be
desirable so there is also a window in which the user is actually idle but
it has not yet been detected.

PROPOSAL

I propose an api which enables an event for the minimum idle timeout and has
a query to determine the current system idle.  The event is fired when the
state changes.  Active->idle, Active->away, idle->away, idle->active,
away->active.

The idle times are all specified in seconds, the event will be fired when
the idle state changes.

Not explicitly specified, and thus intentionally left to the UA, include:
* The event will be fired after the minimum system idle time for the
property; for example 2 minutes. [1]

[Supplemental] interface Window <#window> {
  // Returns the current system idle state.
  int systemIdleState();
  int systemIdleTimeInSeconds();
};

// The event fired when the idle state of the system changes.
interface onSystemIdleChange : Event
{
 const unsigned short AWAY;
 const unsigned short ACTIVE;
 const unsigned short IDLE;

 readonly attribute unsigned short idleState;
 readonly attribute unsigned long idleTimeInSeconds;
};

Where idleState is one of:
  idleState : active = 1, idle = 2, away = 3

Away is defined as locked/screen saver enabled or any other system mechanism
that is defined as away.

Received on Thursday, 17 September 2009 07:40:42 UTC