Raxol.Core.UserPreferences (Raxol v0.2.0)

View Source

Manages user preferences for the Raxol application.

Acts as a GenServer holding the preferences state and handles persistence.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets a user preference value by key path.

Retrieves the entire preferences map.

Forces an immediate save of the current preferences.

Sets a user preference value by key path.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get(key_or_path)

Gets a user preference value by key path.

Accepts a single key or a list of keys for nested access.

Examples

UserPreferences.get(:theme) #=> "dark"
UserPreferences.get([:accessibility, :high_contrast]) #=> true

get_all()

Retrieves the entire preferences map.

save!()

Forces an immediate save of the current preferences.

set(key_or_path, value)

@spec set(atom() | [atom()], any()) :: :ok

Sets a user preference value by key path.

Accepts a single key or a list of keys for nested access. Triggers an automatic save after a short delay.

Examples

UserPreferences.set(:theme, "light")
UserPreferences.set([:accessibility, :high_contrast], false)

start_link(opts)