class timer

superclass(es) object
subclass(es) -
description The timer class can be used to create a timer that generates a callback event after a fixed amount of time.

tasks

With the timer class it is possible to generate onTick callback events at specified intervals, the time between these onTick events is specified in milliseconds. Before a timer is created the maximum number of ticks generated can also be set, see the method putMaxNumTicks/1.

To stop a timer call the method kill/0. Try to use as few timers as possible.

methods

kill

func Stop the timer.
pre TRUE
post The timer has stopped.

create(MilliSecs, Output)

func Create a timer, the value of the variable MilliSecs determine how many milliseconds there will be between each onTick event.
pre The variable MilliSecs must contain an integer value.
post If the timer was created then true was assigned to Output, else if the timer could not be created false was assigned.

active(Output)

func Determine if a timer is active, i.e. if it generates onTick events.
pre TRUE
post If the timer was active true was assigned to Output, else false was assigned.

id(Output)

func Get the ID value of timer, each timer gets a different ID value.
pre TRUE
post If the timer was active the ID value of the timer was assigned to Output, else the value 0 was assigned to Output.

putMaxNumTicks(Max)

func Determine the maximum number of ticks that the timer will generate, the timer must not already be active.
pre The variable Max must contain an integer value.
post The maximum number of ticks was set the value of Max.

maxNumTicks(Max)

func Get the maximum number of ticks that the timer will generate.
pre The variable Max must contain an integer value.
post The maximum number of ticks was assigned to the variable Max. If there is no maximum the value -1 was assigned to the variable Max.

callbacks

onTick(Sender)

func This callback event is generated after a specified number of milliseconds by the timer.
pre The variable Sender refers to the timer instance that generated the event.
post TRUE