mixins/preferences¶
PreferencesMixin¶
-
mixin
PreferencesMixin(category, group[, prefs])¶ Mixin that provides preference functionality.
Arguments: - category (String) – Preferences category.
- group (String) – Preferences group.
- prefs (Object) – The config for the preferences to create. See :js:class:`PrefGroup`s data parameter for details.
-
prefs¶ Type: PreferencesProxy All prefrences related function are collected here.
-
applyPreferences(key, value)¶ This function will be bound to the changed event of the prefrences object. This is also triggered for non-auto applied shortcus.
Arguments: - key (String) – The key of the setting changed. May be undefined if multiple settings changed at once - e.g. after loading the from the DB.
- value – The new value of the setting changed. Only available if the key was set.
-
prefs.vue¶ Type: PrefsGroup (Vue) The preferences group.
-
prefs.get(key)¶ Retrieves the value of a preference item given by key.
Arguments: - key (String) – The key of the preferences item.
Returns: The current value of the preferences item.
-
prefs.set(key[, value[, global]])¶ Retrieves the value of a preference item given by key.
Arguments: - key (String) – The key of the preferences item.
- value – The new value for the preferences item.
- global (Bool) – The value will be set globally, ignoring eventual binding.
-
prefs.watch(key, callback)¶ Watches a specific prefrences items value for changes.
Note
This uses the $watch method of vuejs internally.
Arguments: - key (String) – The key of the preferences item to watch. If null will watch all preferences of the entire group.
Callback args: - oldValue – The old value of the preference before it was changed.
- newValue – The new value of the preference after it was changed.
-
read-only
prefs.autoShortcuts¶ Type: Object(shortcutDefinition => callback) All shortcuts do be automatically applied (by
ShortcutsMixin()).