nsIUpdateTimerManager 编辑

toolkit/mozapps/update/nsIUpdateTimerManager.idlScriptable 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 66 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:108 次

字数:4805

最后编辑:7年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文