JSUTILS.Timer Class
The Timer object wraps the window.setInterval() method to provide an as3-like Timer interface.
Constructor
JSUTILS.Timer
-
delay -
repeatCount
Parameters:
-
delayNumberThe delay (ms) interval between ticks
-
repeatCountNumberThe number of number of ticks. A value of zero will set the timer to repeat forever. Default = 0
Item Index
Properties
Events
Methods
addEventListener
-
type -
listener
Parameters:
-
typeStringThe event type
-
listenerFunctionThe function to be called when the event is fired
dispatchEvent
-
type -
optionalParams
Parameters:
-
typeEventThe Event object.
-
optionalParamsObjectOptional parameters passed as an object. return {boolean} True if dispatch is successful, false if not.
hasEventListener
-
type
Parameters:
-
typeStringThe event type return {boolean} True is listener exists for this type, false if not.
onTick
()
private
removeEventListener
-
type -
listener
Parameters:
-
typeStringThe event type
-
listenerFunctionThe function to be called when the event is fired
reset
()
Stop the timer and reset the count to zero.
start
()
Start the timer.
stop
()
Stop the timer.
Properties
currentCount
Number
[read-only] Returns the current count (number of ticks since timer started).
delay
Number
The delay interval in milliseconds.
repeatCount
Number
The repeat count in milliseconds.
running
Number
[read-only] Returns true if the timer is running.
Events
timerComplete
JSUTILS.TimerEvent.TIMER_COMPLETE
The timerComplete event is dispatched when the repeatCount value
Event Payload:
-
targetJSUTILS.TimerA reference to the Timer object.
timerTick
JSUTILS.TimerEvent.TIMER
The timerTick event is dispatched at the rate specified by the delay interval.
Event Payload:
-
targetJSUTILS.TimerA reference to the Timer object.
