Category: Script Library
configHandler
tagHandler is a script designed for persistent variable storage across different scripts within a single TapForms Pro document.
When an instance of this class is created, the configHandler loads all variables associated with the specified domain to optimize record searching. Variables can be accessed and modified using get and set methods. When a new variable is stored, a new configuration record is created, and the local data copy is updated.
By default, all variables are stored in the form named Config.
Usage
This script is a helper script that is launched from other applications. It doesn't do anything on it's own.
To use this class, first it needs to be loaded:
// load tagHandler class if it is not already loaded
if (typeof configHandler === 'undefined')
document.getFormNamed('Scripts').runScriptNamed('configHandler');
- new configHandler('domain'): Creates a new configHandler class in the given domain.
cfgCRM = new configHandler('CRM');
- cfg.set('name', value): Stores value in variable name and updates the persistent storage accordingly.
cfg.set('string', 'The quick brown fox jumps over the lazy dog'); // string type
cfg.set('integer', 1234); // integer type
cfg.set('object', {"a": "a entry", "b": "b entry"}); // object type
cfg.set('array', ['alpha', 'beta', 'gamma']); // array type
- get: Returns the value stored in the variable name.
console.log(cfg.get('string')); // get string type
console.log(cfg.get('integer')); // get integer type
console.log(JSON.stringify(cfg.get('object'))); // get object type
console.log(JSON.stringify(cfg.get('array'))); // get array type
Concurrent access to the same domain from different applications leads to unpredictable behavior.
Installation
The configHandler script is installed using the scriptHandler script about which you can learn more over here. It is installed in the Scripts form.
Dependencies
none
ChangeLog
Link to ChangeLog
Author
- Daniel Leu, info@danielleu.com
Do you like this script? Are you using it? Please consider supporting me by buying me a coffee!
Thanks!
Last modified: Apr 24, 2025 6:25:03 PM
