Storage for User Interface settings. Wrapper around localStorage
It is recommended to use this module instead of direct access to the localStorage
.
User can clear all settings using User menu
-> Reset GUI Settings
.
Module is injected into Vue.prototype
as $uiSettings
and exported as @unitybase/adminui-vue
.uiSettings
// inside vue can be used as this.$uiSettings
// restore some setting
this.videoRatio = this.$uiSettings.get('UFileWebcamButton', 'videoRatio') ?? this.videoRatios[0]
// save setting
this.$uiSettings.put(this.videoRatios[0], 'UFileWebcamButton', 'videoRatio')
// or from adminui-vue exports
const App = require('@unitybase/adminui-vue')
const isCollapsed = App.uiSettings.get('sidebar', 'isCollapsed')
Methods
# buildKey (component: string, property: string, instanceopt: string) → string inner
Build a key name for storing data based on component, property and optionally instance
# clear (componentopt: string, propertyopt: string) inner
Remove all settings from storage. If component or both component and property are specified - remove only for it
# get (component: string, property: string, instanceopt: string) → * inner
Retrieve value from storage
# getByKey (key: string) → * inner
Arguments:
key
: string
# put (value: *, component: string, property: string, instanceopt: string) inner
Put (save) value into setting storage
# putByKey (value: *, key: string) inner
Put value into storage. If value === undefined - remove storage key
Arguments:
value
: *key
: string