LocalStorage
Spicetify provides a wrapper for localStorage to make it easier to use.
namespace LocalStorage { function clear(): void; function get(key: string): string | null; function remove(key: string): void; function set(key: string, value: string): void;};Methods
clear
Empties the list associated with the object of all key/value pairs, if there are any.
clear(): voidget
Get key value from local storage.
get(key: string): string | null| Parameter | Type | Description |
|---|---|---|
| key | string | Key to get value from. |
Example
const value = Spicetify.LocalStorage.get("foo");remove
Delete key from local storage.
remove(key: string): void| Parameter | Type | Description |
|---|---|---|
| key | string | Key to delete. |
Example
Spicetify.LocalStorage.remove("foo");set
Set new value for key in local storage.
set(key: string, value: string): void| Parameter | Type | Description |
|---|---|---|
| key | string | Key to set value for. |
| value | string | Value to set. |
Example
Spicetify.LocalStorage.set("foo", "bar");