michael@0: /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsITimerCallback; michael@0: michael@0: /** michael@0: * An interface describing a global application service that allows long michael@0: * duration (e.g. 1-7 or more days, weeks or months) timers to be registered michael@0: * and then fired. michael@0: */ michael@0: [scriptable, uuid(0765c92c-6145-4253-9db4-594d8023087e)] michael@0: interface nsIUpdateTimerManager : nsISupports michael@0: { michael@0: /** michael@0: * Register an interval with the timer manager. The timer manager michael@0: * periodically checks to see if the interval has expired and if it has michael@0: * calls the specified callback. This is persistent across application michael@0: * restarts and can handle intervals of long durations. michael@0: * @param id michael@0: * An id that identifies the interval, used for persistence michael@0: * @param callback michael@0: * A nsITimerCallback object that is notified when the interval michael@0: * expires michael@0: * @param interval michael@0: * The length of time, in seconds, of the interval michael@0: * michael@0: * Note: to avoid having to instantiate a component to call registerTimer michael@0: * the component can intead register an update-timer category with comma michael@0: * separated values as a single string representing the timer as follows. michael@0: * michael@0: * _xpcom_categories: [{ category: "update-timer", michael@0: * value: "contractID," + michael@0: * "method," + michael@0: * "id," + michael@0: * "preference," + michael@0: * "interval" }], michael@0: * the values are as follows michael@0: * contractID : the contract ID for the component. michael@0: * method : the method used to instantiate the interface. This should be michael@0: * either getService or createInstance depending on your michael@0: * component. michael@0: * id : the id that identifies the interval, used for persistence. michael@0: * preference : the preference to for timer interval. This value can be michael@0: * optional by specifying an empty string for the value. michael@0: * interval : the default interval in seconds for the timer. michael@0: */ michael@0: void registerTimer(in AString id, michael@0: in nsITimerCallback callback, michael@0: in unsigned long interval); michael@0: };