WorkspaceLayoutStateKey<T>
A typed handle to one layout-scoped key.
Every method takes an optional leaf. Without one, the value belongs to the whole layout (the workspace scope).
Import:
import type { WorkspaceLayoutStateKey } from '@mnaoumov/obsidian-lib/components/workspace-layout-state-component';Signature:
export interface WorkspaceLayoutStateKey<T>Properties
| Property | Type | Description |
|---|---|---|
| get | (leaf?: WorkspaceLeaf) => T | Reads the value: a clone of the stored one, or of the default when nothing is stored or the stored value fails the key's guard. |
| has | (leaf?: WorkspaceLeaf) => boolean | Checks whether a value is stored, valid or not. |
| key | string | The key name, unique within the plugin. |
| onChange | (callback: (change: WorkspaceLayoutStateChange<T>) => void) => () => void | Subscribes to changes of this key made through set or unset, in any scope and from any copy of the library. A layout load is reported through WorkspaceLayoutStateComponent.onLayoutLoad instead. |
| set | (value: T, leaf?: WorkspaceLeaf) => void | Stores a clone of the value and requests a layout save. Storing a value equal to the stored one does nothing. |
| unset | (leaf?: WorkspaceLeaf) => void | Removes the stored value, so get reads the default again, and requests a layout save. |
Links to this page: