Skip to content

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(): void

get

Get key value from local storage.

get(key: string): string | null
ParameterTypeDescription
keystringKey to get value from.

Example

const value = Spicetify.LocalStorage.get("foo");

remove

Delete key from local storage.

remove(key: string): void
ParameterTypeDescription
keystringKey to delete.

Example

Spicetify.LocalStorage.remove("foo");

set

Set new value for key in local storage.

set(key: string, value: string): void
ParameterTypeDescription
keystringKey to set value for.
valuestringValue to set.

Example

Spicetify.LocalStorage.set("foo", "bar");