Struct xpcom::interfaces::nsITimer [] [src]

#[repr(C)]
pub struct nsITimer { /* fields omitted */ }

interface nsITimer : nsISupports

/**
 * The callback interface for timers.
 */

Methods

impl nsITimer
[src]

[src]

Cast this nsITimer to one of its base interfaces.

impl nsITimer
[src]

TYPE_ONE_SHOT: i64 = 0
/**
 * nsITimer instances must be initialized by calling one of the "init" methods
 * documented below.  You may also re-initialize (using one of the init()
 * methods) an existing instance to avoid the overhead of destroying and
 * creating a timer.  It is not necessary to cancel the timer in that case.
 *
 * By default a timer will fire on the thread that created it.  Set the .target
 * attribute to fire on a different thread.  Once you have set a timer's .target
 * and called one of its init functions, any further interactions with the timer
 * (calling cancel(), changing member fields, etc) should only be done by the
 * target thread, or races may occur with bad results like timers firing after
 * they've been canceled, and/or not firing after re-initiatization.
 */
/**
   * Type of a timer that fires once only.
   */

TYPE_REPEATING_SLACK: i64 = 1
/**
   * After firing, a TYPE_REPEATING_SLACK timer is stopped and not restarted
   * until its callback completes.  Specified timer period will be at least
   * the time between when processing for last firing the callback completes
   * and when the next firing occurs.
   *
   * This is the preferable repeating type for most situations.
   */

TYPE_REPEATING_PRECISE: i64 = 2
/**
   * TYPE_REPEATING_PRECISE is just a synonym for
   * TYPE_REPEATING_PRECISE_CAN_SKIP. They used to be distinct, but the old
   * TYPE_REPEATING_PRECISE kind was similar to TYPE_REPEATING_PRECISE_CAN_SKIP
   * while also being less useful. So the distinction was removed.
   */

TYPE_REPEATING_PRECISE_CAN_SKIP: i64 = 3
/**
   * A TYPE_REPEATING_PRECISE_CAN_SKIP repeating timer aims to have constant
   * period between firings.  The processing time for each timer callback
   * should not influence the timer period.  However this timer type
   * guarantees that it will not queue up new events to fire the callback
   * until the previous callback event finishes firing.  If the callback
   * takes a long time, then the next callback will be scheduled immediately
   * afterward, but only once.  This is the only non-slack timer available.
   */

TYPE_REPEATING_SLACK_LOW_PRIORITY: i64 = 4
/**
   * Same as TYPE_REPEATING_SLACK with the exception that idle events
   * won't yield to timers with this type.  Use this when you want an
   * idle callback to be scheduled to run even though this timer is
   * about to fire.
   */

TYPE_ONE_SHOT_LOW_PRIORITY: i64 = 5
/**
   * Same as TYPE_ONE_SHOT with the exception that idle events won't
   * yield to timers with this type.  Use this when you want an idle
   * callback to be scheduled to run even though this timer is about
   * to fire.
   */

[src]

/**
   * Initialize a timer that will fire after the said delay.
   * A user must keep a reference to this timer till it is
   * is no longer needed or has been cancelled.
   *
   * @param aObserver   the callback object that observes the
   *                    ``timer-callback'' topic with the subject being
   *                    the timer itself when the timer fires:
   *
   *                    observe(nsISupports aSubject, => nsITimer
   *                            string aTopic,        => ``timer-callback''
   *                            wstring data          =>  null
   *
   * @param aDelay      delay in milliseconds for timer to fire
   * @param aType       timer type per TYPE* consts defined above
   */

void init (in nsIObserver aObserver, in unsigned long aDelay, in unsigned long aType);

[src]

/**
   * Initialize a timer to fire after the given millisecond interval.
   * This version takes a callback object.
   *
   * @param aFunc      nsITimerCallback interface to call when timer expires
   * @param aDelay     The millisecond interval
   * @param aType      Timer type per TYPE* consts defined above
   */

void initWithCallback (in nsITimerCallback aCallback, in unsigned long aDelay, in unsigned long aType);

[src]

/**
   * Cancel the timer.  This method works on all types, not just on repeating
   * timers -- you might want to cancel a TYPE_ONE_SHOT timer, and even reuse
   * it by re-initializing it (to avoid object destruction and creation costs
   * by conserving one timer instance).
   */

void cancel ();

[src]

/**
   * The millisecond delay of the timeout.
   *
   * NOTE: Re-setting the delay on a one-shot timer that has already fired
   * doesn't restart the timer. Call one of the init() methods to restart
   * a one-shot timer.
   */

attribute unsigned long delay;

[src]

/**
   * The millisecond delay of the timeout.
   *
   * NOTE: Re-setting the delay on a one-shot timer that has already fired
   * doesn't restart the timer. Call one of the init() methods to restart
   * a one-shot timer.
   */

attribute unsigned long delay;

[src]

/**
   * The timer type - one of the above TYPE_* constants.
   */

attribute unsigned long type;

[src]

/**
   * The timer type - one of the above TYPE_* constants.
   */

attribute unsigned long type;

[src]

/**
   * The opaque pointer pass to initWithFuncCallback.
   */

[noscript] readonly attribute voidPtr closure;

[src]

/**
   * The nsITimerCallback object passed to initWithCallback.
   */

readonly attribute nsITimerCallback callback;

[src]

/**
   * The nsIEventTarget where the callback will be dispatched. Note that this
   * target may only be set before the call to one of the init methods above.
   *
   * By default the target is the thread that created the timer.
   */

attribute nsIEventTarget target;

[src]

/**
   * The nsIEventTarget where the callback will be dispatched. Note that this
   * target may only be set before the call to one of the init methods above.
   *
   * By default the target is the thread that created the timer.
   */

attribute nsIEventTarget target;

[src]

/**
   * The number of microseconds this nsITimer implementation can possibly
   * fire early.
   */

[noscript] readonly attribute unsigned long allowedEarlyFiringMicroseconds;

Methods from Deref<Target = nsISupports>

[src]

Cast this nsISupports to one of its base interfaces.

[src]

void QueryInterface (in nsIIDRef uuid, [iid_is (uuid), retval] out nsQIResult result);

[src]

[noscript,notxpcom] nsrefcnt AddRef ();

[src]

[noscript,notxpcom] nsrefcnt Release ();

Trait Implementations

impl XpCom for nsITimer
[src]

IID: nsIID = nsID(1038397701, 13884, 18476, [164, 9, 186, 172, 131, 160, 27, 252])

[src]

Perform a QueryInterface call on this object, attempting to dynamically cast it to the requested interface type. Returns Some(RefPtr) if the cast succeeded, and None otherwise. Read more

impl RefCounted for nsITimer
[src]

[src]

Increment the reference count.

[src]

Decrement the reference count, potentially freeing backing memory.

impl Deref for nsITimer
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.