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

NameTypeOptionalDefaultDescripton
nIntervalNumberchecked1000 The number of milliseconds between the firing of the tick events.

Properties

NameTypegetsetDescripton
enabledBooleancheckedcheckedIf this is false no tick events are fired.
intervalNumbercheckedcheckedThe number of milliseconds between the firing of the tick events. Changing this also stops the timer.
isStartedboolean true if timer is started/running, false otherwise.checkedChecks if the timer is currently running or not.

Methods

NameDescription
startStarts and enables the timer. Every interval ms the tick event is fired (unless the timer has been disabled).
stopStops and disables the timer

Events

NameTypeBubblesDescripton
tickBiEventFires every interval milliseconds for an enabled and started timer.

Static Methods

NameDescription
callOnceThis 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

NameTypeOptionalDefaultDescripton
funFunctionThe function object to call
timeNumberchecked1 The number of milliseconds to wait before calling the function.
objObjectThe object to call the function as a method of.

Return Type

void