nsIUpdateTimerManager 编辑
toolkit/mozapps/update/nsIUpdateTimerManager.idl
Scriptable 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
orcreateInstance
, 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论