Tankōbon / main/db/settings-repository / SettingsRepository
Class: SettingsRepository
Defined in: main/db/settings-repository.ts:18
Persists application settings (key/value, JSON-encoded) to the local database.
Constructors
Constructor
new SettingsRepository(
db,userId?):SettingsRepository
Defined in: main/db/settings-repository.ts:20
userId says whose settings are read and written (the active user, in the app).
Parameters
db
DatabaseSync
userId?
() => string
Returns
SettingsRepository
Methods
getAll()
getAll():
AppSettings
Defined in: main/db/settings-repository.ts:31
The stored settings, merged over DEFAULT_SETTINGS for any key not stored yet: the shared ones as every user set them, the others as the active user did. A row that is unreadable, unknown, no longer valid for its key (a hand-edited database, an older or newer release) or stored on the wrong side counts as not stored: it must not stop the app from starting.
Returns
set()
set(
key,value):void
Defined in: main/db/settings-repository.ts:55
Stores one setting (JSON-encoded), replacing any previous value.
Parameters
key
keyof AppSettings
value
unknown
Returns
void