Application Preferences
5.22.1The Application Preferences API allows applications to store custom data and retrieve it when needed.
The Application Preferences API is accessible through the glue.prefs
object.
APIobject
Description
Application Preferences API
Available since version Glue42 3.12Methods
clearmethod
Signature
() => Promise<void>
Description
Removes preferences for the current application
clearAllmethod
Signature
() => Promise<void>
Description
Removes all preferences stored for the current user
clearFormethod
Signature
(app: string) => Promise<void>
Description
Removes preferences of a specified application.
Parameters
Name | Type | Required | Description |
---|---|---|---|
app | string |
|
getmethod
Signature
(app?: string) => Promise<AppPreferences>
Description
Retrieves preferences for the current application
Parameters
Name | Type | Required | Description |
---|---|---|---|
app | string | Optional - if specified will retrieve preferences for the specified application |
getAllmethod
Signature
() => Promise<AppPreferences[]>
Description
Retrieves all preferences stored for the current user
setmethod
Signature
(data: any, options?: { app: string; }) => Promise<void>
Description
Replaces preferences for the current application. All properties of the data object will be removed and replaced with the ones supplied in the data parameter.
Parameters
Name | Type | Required | Description |
---|---|---|---|
data | any | New data to replace the existing preferences |
|
options | { app: string; } | Optional - if specified can replace preferences of another application |
setFormethod
Signature
(app: string, data: any) => Promise<void>
Description
Replaces preferences for an application. All properties of the data
object will be removed and replaced with the ones supplied in the data
parameter.
Parameters
Name | Type | Required | Description |
---|---|---|---|
app | string | Name of the application whose preferences will be replaced. To replace the preferences for the current app, use the |
|
data | any | New data to replace the existing preferences. |
subscribemethod
Signature
(callback: (prefs: AppPreferences) => void) => () => void
Description
Subscribe for changes to the preferences of the current app.
Available since version Glue42 3.14
Parameters
Name | Type | Required | Description |
---|---|---|---|
callback | (prefs: AppPreferences) => void | The callback will be invoked with the initial value and on every change of the preferences. |
subscribeFormethod
Signature
(app: string, callback: (prefs: AppPreferences) => void) => () => void
Description
Subscribe for changes to the preferences of a specified app.
Available since version Glue42 3.14
Parameters
Name | Type | Required | Description |
---|---|---|---|
app | string | Name of the application for which to subscribe. |
|
callback | (prefs: AppPreferences) => void | The callback will be invoked with the initial value and on every change of the preferences. |
updatemethod
Signature
(data: any, options?: { app: string; }) => Promise<void>
Description
Updates preferences for the current application with the supplied object. This method updates only the specified data properties. Any other existing properties will remain intact.
Parameters
Name | Type | Required | Description |
---|---|---|---|
data | any | Data to be merged into the existing preferences |
|
options | { app: string; } | Optional - if specified can update preferences of another application |
updateFormethod
Signature
(app: string, data: any) => Promise<void>
Description
Updates the preferences for an application with the supplied object. This method updates only the properties specified in the data
object. Any other existing properties will remain intact.
Parameters
Name | Type | Required | Description |
---|---|---|---|
app | string | Name of the application whose preferences will be updated. To update the preferences for the current app, use the |
|
data | any | Data to be merged with the existing preferences. |
AppPreferencesobject
Properties
Property | Type | Default | Required | Description |
---|---|---|---|---|
app | string | |||
data | any | |||
lastUpdate | Date |