platform/node/json-settings-store
Classes
Section titled “Classes”JsonFileSettingsStore
Section titled “JsonFileSettingsStore”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.
Implements
Section titled “Implements”Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new JsonFileSettingsStore(
file,rejectedFile,clock,debounceMs?):JsonFileSettingsStore
Defined in: app/src/platform/node/json-settings-store.ts:44
Parameters
Section titled “Parameters”string
Path of settings.json.
rejectedFile
Section titled “rejectedFile”string
Path of settings.rejected.json.
Schedules debounced writes.
debounceMs?
Section titled “debounceMs?”number = 300
Delay before a write, so bursts of changes cause one write.
Returns
Section titled “Returns”Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Defined in: app/src/platform/node/json-settings-store.ts:117
Cancels a scheduled write without writing it. Call JsonFileSettingsStore.flush first.
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”flush()
Section titled “flush()”flush():
Promise<void>
Defined in: app/src/platform/node/json-settings-store.ts:98
Writes a pending change now, for example during shutdown.
Returns
Section titled “Returns”Promise<void>
load()
Section titled “load()”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.
Returns
Section titled “Returns”Promise<StoredSettings>
Implementation of
Section titled “Implementation of”save()
Section titled “save()”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.
Parameters
Section titled “Parameters”settings
Section titled “settings”Valid user values.
rejected
Section titled “rejected”readonly RejectedSetting[]
Values kept aside because they were invalid.
Returns
Section titled “Returns”Promise<void>
Implementation of
Section titled “Implementation of”Variables
Section titled “Variables”settingsFileVersion
Section titled “settingsFileVersion”
constsettingsFileVersion:1=1
Defined in: app/src/platform/node/json-settings-store.ts:12
Current format version of settings.json.