Skip to content

platform/node/json-settings-store

Defined in: app/src/platform/node/json-settings-store.ts:26

Stores settings in settings.json and values that failed validation in settings.rejected.json. Writes are atomic and debounced; a corrupt file is moved aside instead of being overwritten, and a file that exists but cannot be read is not written over until the next start.

new JsonFileSettingsStore(file, rejectedFile, clock, debounceMs?): JsonFileSettingsStore

Defined in: app/src/platform/node/json-settings-store.ts:44

string

Path of settings.json.

string

Path of settings.rejected.json.

Clock

Schedules debounced writes.

number = 300

Delay before a write, so bursts of changes cause one write.

JsonFileSettingsStore

dispose(): void

Defined in: app/src/platform/node/json-settings-store.ts:117

Cancels a scheduled write without writing it. Call JsonFileSettingsStore.flush first.

void

Disposable.dispose

flush(): Promise<void>

Defined in: app/src/platform/node/json-settings-store.ts:98

Writes a pending change now, for example during shutdown.

Promise<void>

load(): Promise<StoredSettings>

Defined in: app/src/platform/node/json-settings-store.ts:51

Reads the stored user values; an empty set when nothing is stored yet.

Promise<StoredSettings>

SettingsStore.load

save(settings, rejected): Promise<void>

Defined in: app/src/platform/node/json-settings-store.ts:87

Stores the user values and the values that were rejected while loading.

StoredSettings

Valid user values.

readonly RejectedSetting[]

Values kept aside because they were invalid.

Promise<void>

SettingsStore.save

const settingsFileVersion: 1 = 1

Defined in: app/src/platform/node/json-settings-store.ts:12

Current format version of settings.json.