{dialog.object}_ls_getData Method
Syntax
Arguments
- flagstring
Specify what information should be retrieved from Local Storage. The flag can be one of the following values:
- Flag
- Meaning
- a
All keys in Local Storage
- aa
All keys created by UX components. Keys that are added to Local Storage all have 'ALPHA_' as a prefix. Only keys that have this prefix are returned.
- t
All keys for this UX component. These keys all start with 'ALPHA_' followed by the namespace for the component (e.g. ALPHA_NS1). NOTE: The namespace for the component is specified in the UX component properties - Local Storage section.
- o
All other keys (i.e.excluding keys for this UX component). (Same as using the 'a' flag, then removing keys returned for the 't' flag).
- oa
All UX component keys, but excluding keys for this component. (Same as using the 'aa' flag, then removing keys returned for the 't' flag).
- v:t
Key used to persist variables for this UX component. NOTE: The UX component allows you to specify that variables in a component should be persisted to Local Storage (See Local Storage section in UX properties).
- v:a
All UX component keys that store persisted variables (for any UX component, not just this component).
- v:o
All UX components keys that store persisted variables, excluding this UX component (Same as using 'va' and then removing 'vt').
- lists:t
All of the List components in this component that are persisted to Local Storage. NOTE: Not every List in a UX component is persisted to Local Storage. Each List in a UX has its own setting (defined in the List Builder) to control whether it is persisted.
- lists:a
All of the List components (from any UX component) that are persisted to Local Storage.
- lists:o
All of the List components, excluding the Lists in this component. (Same as using 'lists:a' and then removing 'lists:t')
Description
Returns an object with information about keys stored in Local Storage.
Discussion
The {dialog.object}._ls_getData method returns a JSON object containing information about keys stored in Local Storage. The data retrieved can be filtered by specifying a flag that defines the key to look up.
The object returned by this function contains the following properties:
- Property
- Description
- data
An array with information about each key found. The array has an object for each key found. The object has a key and size property indicating the key name of the item and the size in bytes of the item.
- size
The total size in bytes of all keys found.
- keyCount
The number of keys that were found.
Example:
//pass in the 'a' flag to get info on All keys var obj = {dialog.object}._ls_getData('a') console.log('Number of keys: ' + obj.keyCount); console.log('Number of bytes: ' + obj.size); var data = JSON.stringify(obj.data); console.log('Data: ' + data);
Once you have retried the array of information using the {dialog.object}._ls_getData() method, you might want to delete the keys listed in the array. You can pass in the object returned by the {dialog.object}._ls_getData() method to the {dialog.object}._ls_deleteKeys() method.
For example:
//delete all keys in local storage for other UX components var obj = {dialog.object}._ls_getData('o'); {dialog.object}._ls_deleteKeys(obj);
See Also