A custom component may have to store user preferences persistently.
To this end, the editor context object implements the method
getPreferences
of the interface
IEditorContext
. The method returns a
Struct
object that is stored in the
EditorPreferences
document of the current user.
You can modify this struct using the standard struct API
as described in Section 5.4.4, “Structs”.
The class PreferencesUtil
provides two utility 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.