Moscrif API Docs for: 2012q3
Show:

Timer Class

Library: core

Generates recurring events in an application.

Example:

// Just one scheduled execution:
var once = new Timer(100, false); // interval make no sense here
once.start(500); // dealyed start
once.onTick = function(sender) { }

// each 500ms, repeats 3times only:
var threeTimes = new Timer(500, 3);

// each 500ms, repeats forever
var threeTimes = new Timer(500, true);

Item Index

Methods

Events

Methods

this

(
  • interval
  • repeatOrTimes
)

Constructs timer object.

Parameters:

  • interval Float

    Interval in miliseconds at which to raise the onTick event.

  • repeatOrTimes Boolean | Integer

    Boolean value (true or false) indicates whether timer repeats or executes once. Integer value indicates number offset times to be executed0.

dispose

()

Stops and disposes timer object.

start

(
  • [delay]
)

Starts this timer.

Parameters:

  • [delay] Integer optional

    Indicates delayed start. Values is expressed in miliseconds.

stop

()

Stops this timer. Stopped timer is still valid and can be used later. To destruct timer object you have to call dispose() method.

Events

onTick

The onTick event apperas in regular time intervals according to set time interval in costructor.

Example:

var once = new Timer(100, false); // interval make no sense here
once.start(500); // dealyed start
once.onTick = function(sender) { }