What is Storage?
storage is Unbound’s settings store. Values you write are held in memory, broadcast as an event, and saved to disk, so your addon’s configuration survives a reload without any file handling on your part.
Writes are debounced and serialized to Unbound/settings.json in the documents directory, using the fs module. You don’t call read or write yourself. Use get and set.
Stores & keys
Settings are grouped into stores, one per addon. You pick each store’s name, usually your plugin’s id. Keys inside a store are dot-paths.set('appearance.compact', true) writes { appearance: { compact: true } } and creates the intermediate objects for you.
To avoid repeating the store name on every call, use getStore to get a facade scoped to one store. Then call get, set, toggle, or remove on it directly.
Reading & writing
Every read takes a default value, which is returned when the key isn’t set yet. This meansget never returns an unexpected undefined.
get requires a default as its last argument. This keeps the store predictable and keeps undefined out of your UI.Reactivity
In React,useSettingsStore subscribes a component to a store and re-renders it whenever a matching change happens. Pass an optional predicate to narrow which changes trigger a re-render.
Every change emits a changed event. Stores also emit set, toggled, removed, and cleared.
This module owns the values. To give your addon its own screen in Discord’s settings list, see settings. The keys the loader reads from the same file are listed in the settings reference.