What is Storage?
storage is Unbound’s settings store. Anything you write is held in memory, broadcast as an event, and saved to disk for you, so your addon’s configuration survives a reload without you ever touching a file.
Writes are debounced and serialized to Unbound/settings.json in the documents directory (via the fs module). You never call read or write yourself; you just get and set.
Stores & keys
Settings are namespaced into stores, one per addon, keyed by a name you pick (usually your plugin’s id). Within a store, keys are dot-paths: set('appearance.compact', true) writes { appearance: { compact: true } }, creating the intermediate objects for you.
Rather than repeat the store name on every call, grab a scoped facade with getStore and call get/set/toggle/remove on it directly.
Reading & writing
Every read takes a default, returned when the key isn’t set yet, so get never surprises you with undefined.
get requires a default as its last argument. It’s how the store stays predictable, keeping undefined out of your UI.
Reactivity
Every change emits a changed event, and stores emit set, toggled, removed, and cleared too. In React, that means your settings UI can stay in sync for free: useSettingsStore subscribes the component and re-renders it whenever a matching change lands. Pass an optional predicate to narrow which changes trigger a re-render.
Outside React, subscribe imperatively with storage.addListener(predicate, callback). It returns an unsubscribe function. Clean it up when your addon stops.