Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

[Added] JS nuSetStorageItem(), nuGetStorageItem()

Information about updates, news, Code Library
admin
Site Admin
Posts: 2720
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

[Added] JS nuSetStorageItem(), nuGetStorageItem()

Unread post 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');
Post Reply