Move addObservablesTo, addComputablesTo & addSubscribablesTo to Common/Utils

This commit is contained in:
djmaze 2021-03-16 10:59:47 +01:00
parent eda0ee695d
commit 4b6f6b1bfc
18 changed files with 55 additions and 46 deletions

View file

@ -4,7 +4,9 @@ import {
pInt,
settingsSaveHelperSimpleFunction,
changeTheme,
convertThemeName
convertThemeName,
addObservablesTo,
addSubscribablesTo
} from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
@ -34,7 +36,7 @@ export class GeneralAdminSettings {
this.theme = ThemeStore.theme;
this.themes = ThemeStore.themes;
ko.addObservablesTo(this, {
addObservablesTo(this, {
allowLanguagesOnSettings: !!SettingsGet('AllowLanguagesOnSettings'),
newMoveToFolder: !!SettingsGet('NewMoveToFolder'),
attachmentLimitTrigger: SaveSettingsStep.Idle,
@ -87,7 +89,7 @@ export class GeneralAdminSettings {
Remote.saveAdminConfig(fn, data);
};
ko.addSubscribablesTo(this, {
addSubscribablesTo(this, {
mainAttachmentLimit: value =>
Remote.saveAdminConfig(settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this), {
'AttachmentLimit': pInt(value)