Whitebeam Template Reference Documentation

Site Map
 
Home
 
Application Guide
Reference
  Installation
  Configuration
  XML Markup
  JavaScript Classes
  ROM
  Templates
  Environment
  Dev Process
  Tools
  External Links
  Example libraries
Community
Contact Whitebeam
To-Do
Download
Credits
Licence
Whitebeam Users
 
 
 

Whitebeam Template Reference Documentation

System Template

testAndSet()

Call this method to set the value stored in a counter. The change only takes place if the counter contains the 'testValue', or does not currently exist.

Syntax

count = rb.counter.testAndSet(counterName, testValue, newValue, maxLifeTime)

Parameters

The 'testAndSet' method takes 4 parameters:

Name Type/Value Range/Length Description
counterNamestring  Required. The name of the counter
testValuenumber  Required. The value to test against the counter.
newValuenumber  Required. If the test value matches - then change the value in the counter to this value.
maxLifeTimenumber  Optional, default = 1800
Maximum time (in seconds) this variable will exist if it is not read or updated by the system. The default is 1800 (30 minutes).

Results

The 'testAndSet' method returns structure:

Type/Value Range/Length Description
struct count see definition The modified (or not) counter

Example

Whitebeam release 1.3.36
(loadtime : 60ms)