Studio Developer Manual / Version 2406.0
Table Of Contents
A custom component may have to store user preferences persistently.
To this end, the global
@coremedia/studio-client.cap-base-models/preferences/editorPreferences
offers the method
getPreferences
of the interface
IEditorPreferences
. The method returns a
Struct
object that is stored in the
EditorPreferences
content item of the current user.
You can modify this struct using the standard struct API
as described in Section 5.4.4, “Structs”.
To offer a bit more utility, the class
@coremedia/studio-client.cap-base-models/preferences/PreferencesUtil
provides two handy methods
for reading and writing complex objects in the preferences struct:
getPreferencesJSONProperty
and
updatePreferencesJSONProperty
.
These methods support strings, numbers, Boolean, contents,
and complex objects and arrays containing such values.
The Studio API uses these methods internally for
persisting saved searches (including custom filters),
open tabs, dashboard widget states, and bookmarks.