Skip to content

setAppConfig

Writes a vault config key, capturing what it held first so the write can be undone exactly.

Obsidian persists the change (requestSaveConfig) and fires its config-changed event, both of which the app’s own settings UI does too — so anything listening reacts as it would to a user flipping the toggle. A write of the value the key already holds is a no-op in Obsidian itself, and the returned token still describes the state that preceded it.

Import:

import { setAppConfig } from 'obsidian-integration-testing';

Signature:

function setAppConfig(params: SetAppConfigParams): Promise<AppConfigRestore>

Parameters:

ParameterTypeDescription
paramsSetAppConfigParamsThe key, the value, and transport / vault overrides.

Returns: Promise<AppConfigRestore> — A Promise resolving to the AppConfigRestore token to hand restoreAppConfig.


Links to this page: