Skip to content

getObsidianLibState<T>

Retrieves or creates a shared-state ValueWrapper for a given key on globalThis.__obsidianLib.

Import:

import { getObsidianLibState } from '@mnaoumov/obsidian-lib/obsidian-lib-state';

Signature:

function getObsidianLibState(key: string, defaultValue: T): ValueWrapper<T>

Parameters:

Parameter Type Description
key string The key to store or retrieve the shared state under.
defaultValue T The default value to use if the shared state does not exist yet.

Returns: ValueWrapper<T> — The ValueWrapper that stores the shared state.