nsITimer
| IID: | 436a83fa-b396-11d9-bcfa-00112478d626 |
| Inherits From: | nsISupports |
This interface is implemented by the following components:
Constants
Properties
readonly nsITimerCallback callback
The nsITimerCallback object passed to initWithCallback.
readonly voidPtr* closure
The opaque pointer pass to initWithFuncCallback.
PRUint32 delay
The millisecond delay of the timeout
PRUint32 type
The timer type : one shot or repeating
Methods
void cancel ( )
void init ( nsIObserver observer , PRUint32 delay , PRUint32 type )
void initWithCallback ( nsITimerCallback callback , PRUint32 delay , PRUint32 type )
[noscript] void initWithFuncCallback ( nsTimerCallbackFunc callback , voidPtr* closure , PRUint32 delay , PRUint32 type )
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 init ( nsIObserver observer , PRUint32 delay , PRUint32 type )
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.
Observe(nsISupports subject, => nsITimer string topic, => ``timer-callback'' wstring data => null
- Arguments:
- observer: the callback object that observes the ``timer-callback'' topic with the subject being the timer itself when the timer fires:
- delay: delay in milliseconds for timer to fire
- type: timer type per TYPE* consts defined above
void initWithCallback ( nsITimerCallback callback , PRUint32 delay , PRUint32 type )
Initialize a timer to fire after the given millisecond interval. This version takes a function to call and a closure to pass to that function.
- Arguments:
- callback
- delay: The millisecond interval
- type: Timer type per TYPE* consts defined above
void initWithFuncCallback ( nsTimerCallbackFunc callback , voidPtr* closure , PRUint32 delay , PRUint32 type )
Initialize a timer to fire after the given millisecond interval. This version takes a function to call and a closure to pass to that function.
- Arguments:
- callback
- closure: An opaque pointer to pass to that function
- delay: The millisecond interval
- type: Timer type per TYPE* consts defined above
References
This interface is passed as an argument to the following methods:
Reference documentation is generated from Mozilla's source.
