Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

SimpleStorage is an object storage. Just like the Map object in JavaScript, it 's a collection of key/value, and collects the key-value pairs, where the keys can be of any type.

Methods Use the methods of this class can be used. For example, in widget client scripts to operate with objects, for example, to manage the data that can be useful for client-side scripts of the widgets or forms in the future. See the code example below for more clarity.:

Code Block
languagejs
themeEclipse
titleStorage usageExample
linenumberstrue
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"));
}

getItem(key)


Gets Use this method to get a value based on a the key.

NameTypeMandatoryDefault Value
keyStringYN

Return:

TypeDescription
StringThis method returns an item specified by a a value of the specified key.

Example:

Code Block
languagexml
titlegetItem
linenumberstrue
SimpleStorage.getItem('name'); // "Adam"

hasItem(key)


Checks Use this method to check if there 's is a key in the storage.

Parameter:

NameTypeMandatoryDefault value
keyAnyYN

Return:

TypeDescription
BooleanThis method returns 'true' if  if the key specified in the key parameter was found; otherwise, it returns 'false'.

Example:

Code Block
languagexml
titlehasItem
linenumberstrue
SimpleStorage.hasItem('name'); //  true

setItem(key, value)


Sets the Use this method to set a value based on a key.

Parameters:

Name

TypeMandatoryDefault Value
keyStringYN
valueAnyYN

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagexml
titlesetItem
linenumberstrue
SimpleStorage.setItem('name', 'Adam')

getEntries()


Gets Use this method to get an array of pairs (key-value, key).

TypeDescription
ArrayThis method returns an array containing value pairs; otherwise, of arrays containing the keys names and their values; or it returns an empty array.

Example:

Code Block
languagexml
titlegetEntries
linenumberstrue
SimpleStorage.getEntries(); //  [["name", "Adam"],[ ["secondName", "Smith"]]]

getKeys()


Gets Use this method to get an array of keys.

Return:

TypeDescription
ArrayThis method returns an array containing that contains values; otherwise, returns or an empty array.

Example:

Code Block
languagexml
titlegetKeys
linenumberstrue
SimpleStorage.getKeys(); //  ["name", "secondName"]

getSize()


Gets Use this method to get the amount of the values stored.

Return:

TypeDescription
IntegerThis method returns the quantity of values in the storage.

Example:

Code Block
languagexml
titlegetSize
linenumberstrue
SimpleStorage.getSize(); //  2

reset()


Empties Use this method to empty the storage.

Return:

TypeDescription
VoidThis method does not return a value.

Example:

Code Block
languagejs
themeEclipse
titlereset
SimpleStorage.reset();


Table of Contents
classfixedPosition