mixinafReflux::Preferences
afReflux::Preferences
@
Js
(Service) - Loads / saves and maintains a cache of preference objects. Instances are cached until the backing file is updated / modified.
Because Reflux is application centric, preference files are not associated with pods, but with the application name supplied at startup:
%FAN_HOME%/etc/<app-name>/xxx.fog
Note that Preference
instances must be serializable and have an it-block ctor:
new make(|This| f) { f(this) }
- findFile
abstract File? findFile(Str name)
Finds the named file in the applications
etc
dir. If such a file does not exist, a file in theworkDir
is returned.- loadPrefs
abstract Obj loadPrefs(Type prefsType, Str? name := null)
Returns an instance of the given preferences object.
preferences.loadPrefs(MyPrefs#, "myPrefs.fog")
- savePrefs
abstract Void savePrefs(Obj prefs, Str? name := null)
Saves the given preference instance.
preferences.savePrefs(myPrefs, "myPrefs.fog")
- updated
abstract Bool updated(Type prefsType, Str? name := null)
Returns
true
if the preferences file has been updated since it was last read.