api.storage
StorageApi
A small key-value store of the plugin's own, kept in the browser's local storage under the plugin's id and listed with everything else in Preferences ▸ Browser storage.
Members
get
get<T>(key: string, fallback: T): T;
Read a value, or fallback when the key was never set.
const options = api.storage.get("options", { showGrid: true });
const kept = api.storage.set("options", { ...options, showGrid: false });
if (!kept) api.ui.toast({ kind: "error", title: "Could not save the options", detail: "The browser's storage is full." });Try itset
set(key: string, value: unknown): boolean;
Store a value. False when the browser refused the write — its storage quota is a few megabytes for the whole editor — so a plugin keeping something the user made can say so instead of losing it silently.
remove
remove(key: string): void;