D028868 CR1500 CR1100 CR2700 JavaScript Programming Guide User Manual Page 33 of 41
The Code Corporation
12393 South Gateway Park Place, Suite 600, Draper, UT 84020
+1 (801) 495-2200
FAX +1 (801) 495-0280
jsSettings.def(param, val)
Set the parameter param to the default value val.
This must be done before a parameter is referenced for the first time (i.e.
jsSettings.def() must be called before any call to
jsSettings.set()/jsSettings.put()/jsSettings.reset()/jsSettings.
get()). This is important to ensure the run-time list of settings contains the appropriate
default value when the settings file is empty.
jsSettings.put(param, val)
Set the parameter param to the value val and store in RAM. This is a temporary set and will
not persist through a reboot.
jsSettings.set(param, val)
Set the parameter param to the value val, update settings in RAM and store in ‘.settings.txt’
file on the reader. This is a permanent set and will persist through a reboot.
jsSettings.reset(param)
Reset param to the default value set in jsSettings.def().
jsSettings.get(param)
Get the current value of a parameter param. This will get the current value stored in RAM.
This example illustrates using regular expression to replace each uppercase letter ‘A’ in the
decode string with lowercase letter ‘a’. The properties of the Decode object are described in
Section 4.
Example:
include(".settings.js");
function triggerDecodeNormal()
{
P0_intervalDelay_sec = jsSettings.get("P0");
if( P0_last != P0_intervalDelay_sec )
{
P0_last = P0_intervalDelay_sec;
reader.clearInterval(intervalId);
intervalId = reader.setInterval(triggerDecodeNormal,
P0_intervalDelay_sec);
}
};
rules_onConfigure = function(data)
{
if( jsSettings.parseUserParams )
return jsSettings.parseUserParams(data);
return false;