Class JSUTILS.Timer
Extends
JSUTILS.EventDispatcher.
The Timer object wraps the window.setInterval() method to provide
an as3-like Timer interface.
Defined in: Timer.js.
| Constructor Attributes | Constructor Name and Description |
|---|---|
|
JSUTILS.Timer(delay, repeatCount)
An as3-like Timer object
|
| Field Attributes | Field Name and Description |
|---|---|
|
[read-only] Returns the current count (number of ticks since timer started).
|
|
|
The delay interval in milliseconds.
|
|
|
The repeat count in milliseconds.
|
|
|
[read-only] Returns true if the timer is running.
|
| Method Attributes | Method Name and Description |
|---|---|
|
reset()
Stop the timer and reset the count to zero.
|
|
|
start()
Start the timer.
|
|
|
stop()
Stop the timer.
|
- Methods borrowed from class JSUTILS.EventDispatcher:
- addEventListener, dispatchEvent, hasEventListener, removeEventListener
| Event Attributes | Event Name and Description |
|---|---|
|
The timerComplete event is dispatched when the repeatCount value
has been reached.
|
|
|
The timerTick event is dispatched at the rate specified
by the delay interval.
|
Class Detail
JSUTILS.Timer(delay, repeatCount)
An as3-like Timer object
- Parameters:
- {Number} delay
- The delay (ms) interval between ticks
- {Number} repeatCount
- The number of number of ticks. A value of zero will set the timer to repeat forever. Default = 0
Field Detail
{Number}
currentCount
[read-only] Returns the current count (number of ticks since timer started).
{Number}
delay
The delay interval in milliseconds.
{Number}
repeatCount
The repeat count in milliseconds.
{Number}
running
[read-only] Returns true if the timer is running.
Method Detail
reset()
Stop the timer and reset the count to zero.
start()
Start the timer.
stop()
Stop the timer.
Event Detail
{JSUTILS.TimerEvent.TIMER_COMPLETE}
timerComplete
The timerComplete event is dispatched when the repeatCount value
has been reached.
- This event has the following properties:
- {JSUTILS.Timer} target
- A reference to the Timer object.
{JSUTILS.TimerEvent.TIMER}
timerTick
The timerTick event is dispatched at the rate specified
by the delay interval.
- This event has the following properties:
- {JSUTILS.Timer} target
- A reference to the Timer object.
