Class R.lang.AbstractTimer
Extends
R.engine.BaseObject.
The base abstract class for all timer objects.
Defined in: abstracttimer.js.
Constructor Attributes | Constructor Name and Description |
---|---|
R.lang.AbstractTimer(name, interval, callback)
Create a timer object
|
Method Attributes | Method Name and Description |
---|---|
cancel()
Cancel the timer.
|
|
destroy()
Stop the timer and remove it from the system
|
|
Get the callback function for this timer.
|
|
Get the class name of this object
|
|
Get the interval of this timer, in milliseconds.
|
|
getTimer()
Get the underlying system timer object.
|
|
Returns true if the timer is currently running.
|
|
pause()
Pause the timer.
|
|
release()
Releast the timer instance back into the pool
|
|
restart()
Cancel the running timer and restart it.
|
|
setCallback(callback)
Set the callback function for this timer.
|
|
setInterval(interval)
Set the interval of this timer.
|
|
setTimer(timer)
Set the underlying system timer object.
|
- Methods borrowed from class R.engine.BaseObject:
- addEvent, addEvents, getElement, jQ, removeEvent, setElement, triggerEvent, update
- Methods borrowed from class R.engine.PooledObject:
- clearObjectDataModel, getId, getName, getObjectDataModel, getProperties, isDestroyed, setName, setObjectDataModel, toString, toXML
Class Detail
R.lang.AbstractTimer(name, interval, callback)
Create a timer object
- Parameters:
- name
- {String} The name of the timer
- interval
- {Number} The interval for the timer, in milliseconds
- callback
- {Function} The function to call when the interval is reached
Method Detail
cancel()
Cancel the timer.
destroy()
Stop the timer and remove it from the system
{Function}
getCallback()
Get the callback function for this timer. When the callback is called,
the scope of the function will be the Timer itself.
- Returns:
- {Function} The callback function
{String}
getClassName()
Get the class name of this object
- Returns:
- {String} "R.lang.AbstractTimer"
{Number}
getInterval()
Get the interval of this timer, in milliseconds.
- Returns:
- {Number} The interval
{Object}
getTimer()
Get the underlying system timer object.
- Returns:
- {Object}
{Boolean}
isRunning()
Returns true if the timer is currently running.
- Returns:
- {Boolean} true if the timer is running
pause()
Pause the timer. In the case where a timer was already processing,
a restart would begin the timing process again with the full time
allocated to the timer. In the case of multi-timers (ones that retrigger
a callback, or restart automatically a number of times) only the remaining
iterations will be processed.
release()
Releast the timer instance back into the pool
restart()
Cancel the running timer and restart it.
setCallback(callback)
Set the callback function for this timer. If the timer is
currently running, it will be restarted.
- Parameters:
- callback
- {Function} A function object to call
setInterval(interval)
Set the interval of this timer. If the timer is running, it
will be cancelled.
- Parameters:
- interval
- {Number} The interval of this timer, in milliseconds
setTimer(timer)
Set the underlying system timer object.
- Parameters:
- timer
- {Object} The timer object