Constructor |
new |
Storage() |
Storage constructor.
Use this API to access local storage on Nigel.
Note: Do not use general JavaScript Window.localStorage and Window.sessionStorage APIs to access Nigel local storage.
Summary
Methods |
clear
|
Removes all stored items. |
getItem
|
Gets the item associated with the specified key. |
key
|
Gets the key that is associated with the specified position. |
length
|
Returns the number of stored items. |
removeItem
|
Deletes an item associated to the specified key. |
setItem
|
Saves an item to the storage. |
Methods
clear()
Removes all stored items.
getItem(key)
Gets the item associated with the specified key.
Parameters
Name |
Type |
Description |
key |
string |
The key of the item that you want to retrieve from the storage. |
Returns
Type |
Description |
string |
Data |
key(index)
Gets the key that is associated with the specified position.
Parameters
Name |
Type |
Description |
index |
number |
The position of the key that you want to retrieve the item of. |
Returns
Type |
Description |
string |
The name of the key that you want to retrieve the item of. |
length()
Returns the number of stored items.
Returns
Type |
Description |
number |
The number of items |
removeItem(key)
Deletes an item associated to the specified key.
Parameters
Name |
Type |
Description |
key |
string |
The name of the key that you want to delete the item of. |
setItem(key, data)
Saves an item to the storage.
Parameters
Name |
Type |
Description |
key |
string |
The key of the item that you want to save. |
data |
string |
The value of the item that you want to save. |