Public Member Functions | Public Attributes

nsIIdleService Interface Reference

This interface lets you monitor how long the user has been 'idle', i.e. More...

import "nsIIdleService.idl";

List of all members.

Public Member Functions

void addIdleObserver (in nsIObserver observer, in unsigned long time)
 Add an observer to be notified when the user idles for some period of time, and when they get back from that.
void removeIdleObserver (in nsIObserver observer, in unsigned long time)
 Remove an observer registered with addIdleObserver.

Public Attributes

readonly attribute unsigned long idleTime
 The amount of time in milliseconds that has passed since the last user activity.

Detailed Description

This interface lets you monitor how long the user has been 'idle', i.e.

not used their mouse or keyboard. You can get the idle time directly, but in most cases you will want to register an observer for a predefined interval. The observer will get an 'idle' notification when the user is idle for that interval (or longer), and receive a 'back' notification when the user starts using their computer again.


Member Function Documentation

void nsIIdleService::addIdleObserver ( in nsIObserver  observer,
in unsigned long  time 
)

Add an observer to be notified when the user idles for some period of time, and when they get back from that.

Parameters:
observer the observer to be notified
time the amount of time in seconds the user should be idle before the observer should be notified.
Note:
The subject of the notification the observer will get is always the nsIIdleService itself. When the user goes idle, the observer topic is "idle" and when they get back, the observer topic is "back". The data param for the notification contains the current user idle time.
You can add the same observer twice.
Most implementations need to poll the OS for idle info themselves, meaning your notifications could arrive with a delay up to the length of the polling interval in that implementation. Current implementations use a delay of 5 seconds.
void nsIIdleService::removeIdleObserver ( in nsIObserver  observer,
in unsigned long  time 
)

Remove an observer registered with addIdleObserver.

Parameters:
observer the observer that needs to be removed.
time the amount of time they were listening for.
Note:
Removing an observer will remove it once, for the idle time you specify. If you have added an observer multiple times, you will need to remove it just as many times.

Member Data Documentation

readonly attribute unsigned long nsIIdleService::idleTime

The amount of time in milliseconds that has passed since the last user activity.


The documentation for this interface was generated from the following file: