new Storage()
A class for storing data in the browser's local storage or session storage.
- Source
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.
- Source
(static) Get(key) → {string}
Get a value from the browser's local storage or session storage.
Parameters:
Name | Type | Description |
---|---|---|
key | string | The key of the data to be retrieved. |
- Source
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:
Name | Type | Description |
---|---|---|
key | string | The key of the data to be removed. |
- Source
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:
Name | Type | Default | Description |
---|---|---|---|
key | string | The key of the data to be stored. | |
value | string | The value of the data to be stored. | |
persistent | boolean | false | Whether the data should be stored in the local storage or session storage. |
- Source