This interface provides a global application service that provides support for long-duration timers (on the order of many days, weeks, or even months). These timers are used to schedule update checks in the future, for example.
Gecko 1.8
Inherits from: nsISupports Last changed in Gecko 1.8 (Firefox 1.5 / Thunderbird 1.5 / SeaMonkey 1.0)

Method overview

void registerTimer(in AString id, in nsITimerCallback callback, in unsigned long interval);



Presents a user interface that checks for and displays the available updates.

void registerTimer(
  in AString id,
  in nsITimerCallback callback,
  in unsigned long interval
An ID used to identify the timer interval; used for persistence.
An nsITimerCallback object that is notified when the interval expires.
The length of time, in seconds, until the timer should fire.


Note that the timer is not precise, and that the default minimum interval is 2 minutes.

In order to avoid having to instantiate a component to call the registerTimer() method, the component can instead register an update-timer category with comma-separated values as a single string representing the timer, like this:

_xpcom_categories: [{ category: "update-timer",
                      value:  "contractID," +
                              "method," +
                              "id," +
                              "preference," +
                              "interval" }], 

This allows you to schedule the timer without actually having to instantiate the component; instead, the component is instantiated when the timer is triggered.

The values are:

The component's contract ID.
The method used to instantiate the interface; this should be either getService or createInstance, depending on your component.
The ID that identifies the interval; this is the same ID you would pass into registerTimer().
The preference for the timer interval; this allows a preference to override the default interval. This can be an empty string if the default interval should not be overridden.
The same interval that would be passed into registerTimer().

See also

Document Tags and Contributors

Contributors to this page: Sheppy, ttaubert, trevorh
Last updated by: Sheppy,