CountTimer

The CountTimer object dispatches the event at the times that was registered. It is used for an altanative for setInterval and setTimeout.

new CountTimer(delay, repeatCount)

Creates CountTimer object

Parameters:
Name Type Description
delay Number A millisecond between the object dispatches events.
repeatCount int The total number of times the timer is set to run. If the repeat count set to 0, the timer runs indefinitely.

Methods

addEventListener(type, callback)

Registers an event listener object to EventDispatcher object so that the listener receives the notification.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

dispatchEvent(Event)

Dispatches an event to the event flow.

Parameters:
Name Type Description
Event arc.Event object

getDelay() → {Number}

Returns the delay.

Returns:
Number A millisecond between the object dispatches events.

getRepeatCount() → {int}

Returns the repeatCount.

Returns:
int The total number of times the timer is set to run. If the repeat count set to 0, the timer runs indefinitely.

removeEventListener(type, callback)

Removes a listener from the EventDispatcher object.

Parameters:
Name Type Description
type String The type of event.
callback Function The listener function.

reset()

Resets the timer.

setDelay(value)

Sets the delay.

Parameters:
Name Type Description
value Number A millisecond between the object dispatches events.

setRepeatCount(repeatCount)

Set the repeatCount.

Parameters:
Name Type Description
repeatCount int The total number of times the timer is set to run. If the repeat count set to 0, the timer runs indefinitely.

start()

Starts the timer.

stop()

Stops the timer.