You are viewing an old version of this page. View the current version.
Compare with Current View Page History
« Previous Version 3 Next »
SimpleStorage is an object storage. Just like the Map object in JavaScript, it is a collection of keys (or values), where the keys can be of any type.
Use the methods of this class, for example, in the widget client scripts to operate the objects. See the code example below:
if (SimpleStorage.hasItem('portalLogo')) { s_widget.setFieldValue("HasLogo", true); s_widget.setFieldValue("logo", SimpleStorage.getItem("portalLogo")); } else { await s_widget.serverUpdate(); SimpleStorage.setItem('portalLogo', s_widget.getFieldValue("logo")); }
Use this method to get a value based on the key.
Return:
Example:
SimpleStorage.getItem('name'); // "Adam"
Use this method to check if there is a key in the storage.
Parameter:
SimpleStorage.hasItem('name'); // true
Use this method to set a value based on a key.
Parameters:
Name
SimpleStorage.setItem('name', 'Adam')
Use this method to get an array of pairs (value, key).
SimpleStorage.getEntries(); // [["name", "Adam"],[ ["secondName", "Smith"]]]
Use this method to get an array of keys.
SimpleStorage.getKeys(); // ["name", "secondName"]
Use this method to get the amount of the values stored.
SimpleStorage.getSize(); // 2
Use this method to empty the storage.
SimpleStorage.reset();