Timer Module

RhoElements 2.x API


The Timer Module is used to set a timer and register an action to be performed when the timer expires. Once the timer is started, the interval time cannot be changed without stopping and restarting the timer.


timer (Module) <META> Syntax

<META HTTP-Equiv="Timer" content="[method / parameter]">

<META HTTP-Equiv="Timer" content="Timeout:url('[jsFunction | url]')">

Timer JavaScript Object Syntax:
By default the JavaScript Object 'timer' will exist on the current page and can be used to interact directly with the timer.
To Invoke timer methods via JavaScript use the following syntax: timer.method();

e.g. timer.start();

To Set timer parameters via JavaScript use the following syntax: timer.parameter = 'value'; remembering to enclose your value in quotes where appropriate.

e.g. timer.interval = 'value';

To Set timer return events via JavaScript use the following syntax: timer.event = JavaScript Function;

e.g. timer.timeout = 'doFunction(%json)';

To set multiple EMML parameters / events on a single line use the following syntax: timer.setEMML("[Your EMML Tags]");

e.g. timer.setEMML("interval:value;timeout:url('JavaScript:doFunction(%json)');start");


Items listed in this section indicate methods or, in some cases, indicate parameters which will be retrieved.

NameDescriptionDefault Value
startStarts the timer. The timer will expire after an interval as specified in the 'Interval' parameterNot Started
stopStops the timer if there is currently one runningNot Started


Items listed in this section indicate parameters, or attributes which can be set.

NamePossible ValuesDescriptionDefault Value
interval:[Value] Values greater than or equal to 500 millisecondsThe duration the timer should run for, specified in milliseconds. This must be specified before the timer is started.1000 milliseconds (1 second)


Values are returned to the caller in RhoElements via Events. Most modules contain events and those returned from this module are given below along with the event parameters. Events can cause a navigation to a new URL or a JavaScript function on the page to be invoked. Each event will in most cases have a number of parameters associated with it which will either be strings or JavaScript arrays. Event parameters can be accessed either directly or via JSON objects.


The Timeout event is triggered when the timer expires and returns the current time.

1timeThe current time from the device clock. Format is DD/MM/YY HH:MM:SS


RhoElements Version1.0.0 or above
Supported DevicesAll supported devices.
Minimum RequirementsNone.
PersistencePartially Persistent - Changes to this module will persist when navigating to a new page with the exception of timeout event.

HTML/JavaScript Examples

The following example sets the timerinterval to 5 seconds:

<META HTTP-EQUIV="Timer" CONTENT="Interval:5000; Timeout:url('JavaScript:doTimer('%s');'); Start">

The following example shows a JavaScript alert at 10 second intervals:

    <META HTTP-EQUIV="Timer" CONTENT="Interval:10000; Timeout:url('JavaScript:doTimer('%s');'); Start">
  <SCRIPT LANGUAGE="javascript">
    function doTimer(time)
      divTimer.innerHTML = 'Time: ' + time;
  <BODY><DIV ID="divTimer"></DIV></BODY>