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 (componentstring, propertystring, instanceoptstring) → string inner

Build a key name for storing data based on component, property and optionally instance

Arguments:

# clear (componentoptstring, propertyoptstring) inner

Remove all settings from storage. If component or both component and property are specified - remove only for it

Arguments:
  • component: string

    Optional name of the component to remove settings for

  • property: string

    Optional name of the component property remove settings for. Component must be specified

# get (componentstring, propertystring, instanceoptstring) → * inner

Retrieve value from storage

Arguments:
  • component: string

    Name of the component setting is stored for

  • property: string

    Property name (usually - a component property)

  • instance: string

    Optional - name of the component instance, if case settings stored per-instance

# getByKey (keystring) → * inner

Arguments:

# put (value*, componentstring, propertystring, instanceoptstring) inner

Put (save) value into setting storage

Arguments:
  • value: *
  • component: string

    Name of the component setting is stored for

  • property: string

    Property name (usually - a component property)

  • instance: string

    Optional - name of the component instance, if case settings stored per-instance

# putByKey (value*, keystring) inner

Put value into storage. If value === undefined - remove storage key

Arguments: