SettingsStore

Up and coming: shot check knows this class and its members today, and programs run it once the native runtime lands.

ShotInstancenot creatablecomingData and time

Up and coming

Remember settings and state between runs, without ever leaving half a file.

A small key-value store kept in a JSON file: read once, then saved in the background about 0.5 s after the last change. A save writes a temporary file and moves it over the old one, so a crash never leaves half a file. When another program edits the file, it is read again and KeyChanged says so.

Properties

NameTypeDefaultDescription
Pathstring
AutoSavebooleanWhen true, the default, the store saves about 0.5 s after the last change.
Unsavedboolean

Methods

NameArgumentsReturnsDescription
Get(key: string)any
Set(key: string, value: any)()
Update(key: string, transform: (old: any) -> any)()
Remove(key: string)()
GetKeys(){ string }
SaveAsync
yields
()(boolean, string?)Writes a temporary file and moves it over the old one, so a crash never leaves half a file.

Events

NamePassesDescription
KeyChanged(string, any, ChangeSource)Fires with the key, its new value and where the change came from: "Program", or "Disk" when another program edited the file.
From ShotInstance 33