BiTimer
This class can be used to schedule events to occur later in time.
This class extends BiEventTarget and therefore all methods and fields available for BiEventTarget are also available for BiTimer .
Constructor
new BiTimer ( [ nInterval ] )
Parameters
| Name | Type | Optional | Default | Descripton |
nInterval | Number | ![]() | 1000 | The number of milliseconds between the firing of the tick events. |
Properties
| Name | Type | get | set | Descripton |
enabled | Boolean | ![]() | ![]() | If this is false no tick events are fired. |
interval | Number | ![]() | ![]() | The number of milliseconds between the firing of the tick events. Changing this also stops the timer. |
isStarted | boolean true if timer is started/running, false otherwise. | ![]() | Checks if the timer is currently running or not. |
Methods
| Name | Description |
start | Starts and enables the timer. Every interval ms the tick event is fired (unless the timer has been disabled). |
stop | Stops and disables the timer |
Events
| Name | Type | Bubbles | Descripton |
tick | | Fires every interval milliseconds for an enabled and started timer. |
Static Methods
| Name | Description |
callOnce | This method calls a function once after a certain time. The thirde argument allows you to set what object the function is a method of allowing you to correctly use the this keyword in the function. |
Static Fields
None.
Remarks
Be careful when using timers so that they are not fired when some dependent object has been disposed. Either dispose or stop the timer object when it no longer can be used due to its dependencies.
Method Details
start
Starts and enables the timer. Every interval ms the tick event is fired (unless the timer has been disabled).
Syntax
object.start ( ) Parameters
No arguments.
Return Type
void
stop
Stops and disables the timer
Syntax
object.stop ( ) Parameters
No arguments.
Return Type
void
Static Method Details
callOnce
This method calls a function once after a certain time. The thirde argument allows you to set what object the function is a method of allowing you to correctly use the this keyword in the function.
Syntax
BiTimer . callOnce ( fun [ ,time,obj ] ) Parameters
| Name | Type | Optional | Default | Descripton |
fun | Function | The function object to call | ||
time | Number | ![]() | 1 | The number of milliseconds to wait before calling the function. |
obj | Object | The object to call the function as a method of. |
Return Type
void
