Interface: ExtensionStorage
Defined in: packages/sdk/src/extension-storage.ts:18
Namespaced, persisted key/value storage handed to extensions. Two scopes are exposed on ExtensionContext.storage (ExtensionStorageScopes): global (one bag per extension, shared across every workspace) and workspace (one bag per extension × the active workspace). Side panels also receive a workspace-scoped bag keyed by panel id via SidePanelProps.storage.
Values persist alongside the rest of the app state. The store hydrates asynchronously, and the workspace bag is swapped when the active workspace changes, so consumers that need to react to restored or switched values should subscribe and re-read.
Methods
get()
Call Signature
get<T>(key): T | undefined;Defined in: packages/sdk/src/extension-storage.ts:20
Read a value. Returns fallback if the key is missing.
Type Parameters
T
T
Parameters
key
string
Returns
T | undefined
Call Signature
get<T>(key, fallback): T;Defined in: packages/sdk/src/extension-storage.ts:21
Type Parameters
T
T
Parameters
key
string
fallback
T
Returns
T
set()
set(key, value): void;Defined in: packages/sdk/src/extension-storage.ts:23
Write a value. undefined deletes the key.
Parameters
key
string
value
unknown
Returns
void
keys()
keys(): string[];Defined in: packages/sdk/src/extension-storage.ts:25
The keys currently set in this namespace.
Returns
string[]
subscribe()
subscribe(listener): Disposable;Defined in: packages/sdk/src/extension-storage.ts:35
Subscribe to changes in this namespace. Called when a value in this namespace changes, when the underlying app state finishes hydrating, and (for the workspace scope) when the active workspace changes.
Returns a Disposable — call .dispose() to unsubscribe, or push it onto ctx.subscriptions for automatic teardown. Consistent with every other subscription in the SDK.
Parameters
listener
() => void