Caplin Trader 4.7.1

Interface: module:caplin/services/PreferencesService

module:caplin/services/PreferencesService

A service that manages saving and retrieving of a user's preferences. A preference is a string value stored using a key (a simple map).

Methods

getPreference(preferenceKey) → {String}

Returns the user preference.
Parameters:
Name Type Description
preferenceKey String string preference key.
Returns:
String preference value.
Type
String

getPreferences() → {Map}

Returns a map of preferences that the user has set either within the current session or in a previous session.
Returns:
a map of preference names to values
Type
Map

removePreference(preferenceKey)

Deletes the user preference.
Parameters:
Name Type Description
preferenceKey String The preference to remove.

savePreferences()

Persists the current user preferences.

setPreference(preferenceKey, preferenceValue)

Sets the user preference.
Parameters:
Name Type Description
preferenceKey String The preference key to set
preferenceValue String The value to set.

setPreferences(preferences)

Sets user preferences from a map of preference names to preference values.
Parameters:
Name Type Description
preferences Map the map of preferences names to values