Page 1 of 1

[Added] JS nuSetStorageItem(), nuGetStorageItem()

Posted: Thu Jun 16, 2022 6:28 am
by admin
nuSetStorageItem(key, value, storage, ttl)

is used to create a new key-value pair in the localStorage or sessionStorage

Parameters:

key: A string containing the name of the key you want to create/update.
value: A string containing the value you want to give the key you are creating/updating.
storage: (optional, default: "local"). A string containing "session" or "local"
ttk: (optional). A number containing the expiry time in seconds.

Example:

Code: Select all

nuSetStorageItem(‘my_key’,’123’);

nuGetStorageItem(key, storage)

is used to retrieve a value that has been stored using nuSetStorageItem(),
or null if the key does not exist, in the given Storage object.

Example:

Code: Select all

let myKey = nuGetStorageItem('my_key');