Storage

new Storage()

A class for storing data in the browser's local storage or session storage.

Example
// Set a value in the session storage
Storage.Set("key", "value");

// Get a value from the session storage
let value = Storage.Get("key");

Methods

(static) Clear()

Clear the browser's local storage or session storage.

(static) Get(key) → {string}

Get a value from the browser's local storage or session storage.

Parameters:
NameTypeDescription
keystring

The key of the data to be retrieved.

Returns:

The data stored in the browser's local storage or session storage.

Type: 
string

(static) Remove(key) → {string}

Remove a value from the browser's local storage or session storage.

Parameters:
NameTypeDescription
keystring

The key of the data to be removed.

Returns:

The data stored in the browser's local storage or session storage.

Type: 
string

(static) Set(key, value, persistent)

Set a value in the browser's local storage or session storage.

Parameters:
NameTypeDefaultDescription
keystring

The key of the data to be stored.

valuestring

The value of the data to be stored.

persistentbooleanfalse

Whether the data should be stored in the local storage or session storage.