Skip to content

LocalSettingsRecoveryStore

A SettingsRecoveryStore in a device-local LocalDataStore, keeping the newest few copies.

It opens its database per call and closes it again: copies are kept and read rarely (a load that found a damaged file, a lossy first save, the user asking for the list), so holding a connection for the plugin’s lifetime would only add a resource to tie to an unload.

Import:

import { LocalSettingsRecoveryStore } from '@mnaoumov/obsidian-lib/settings-recovery';

Signature:

export class LocalSettingsRecoveryStore implements SettingsRecoveryStore

Implements: SettingsRecoveryStore

Constructor

new LocalSettingsRecoveryStore(params: LocalSettingsRecoveryStoreConstructorParams)

Creates a new store.

Properties

PropertyTypeDescription
keep(params: SettingsRecoveryStoreKeepParams) => Promise<SettingsRecoveryCopy>Keeps a copy. A copy whose raw text is already kept is not duplicated; the existing one is returned.
(Inherited from SettingsRecoveryStore)
list() => Promise<SettingsRecoveryCopy[]>Lists the kept copies.
(Inherited from SettingsRecoveryStore)
remove(id: string) => Promise<void>Removes a kept copy. Removing an id that is not kept does nothing.
(Inherited from SettingsRecoveryStore)

Methods

MethodReturnsDescription
keep(params)Promise<SettingsRecoveryCopy>Keeps a copy, dropping the oldest ones beyond the limit in the same transaction.
list()Promise<SettingsRecoveryCopy[]>Lists the kept copies.
remove(id)Promise<void>Removes a kept copy.

Links to this page: