nsIUpdateTimerManager

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.
1.0
28
Introduced
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);

Methods

registerTimer()

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

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

Remarks

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:

contractID
The component's contract ID.
method
The method used to instantiate the interface; this should be either getService or createInstance, depending on your component.
id
The ID that identifies the interval; this is the same ID you would pass into registerTimer().
preference
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.
interval
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,