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

@ -1,8 +1,9 @@
import ko from 'ko';
import { delegateRunOnDestroy } from 'Common/UtilsUser';
import { Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import { addObservablesTo } from 'Common/Utils';
import { delegateRunOnDestroy } from 'Common/UtilsUser';
import { SieveUserStore } from 'Stores/User/Sieve';
import Remote from 'Remote/User/Fetch';
@ -18,7 +19,7 @@ export class FiltersUserSettings {
this.scripts = SieveUserStore.scripts;
this.loading = ko.observable(false).extend({ debounce: 200 });
ko.addObservablesTo(this, {
addObservablesTo(this, {
serverError: false,
serverErrorDesc: ''
});

View file

@ -4,7 +4,7 @@ import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { SaveSettingsStep } from 'Common/Enums';
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { settingsSaveHelperSimpleFunction, addObservablesTo } from 'Common/Utils';
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin';
@ -47,7 +47,7 @@ export class GeneralUserSettings {
this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
ko.addObservablesTo(this, {
addObservablesTo(this, {
mppTrigger: SaveSettingsStep.Idle,
editorDefaultTypeTrigger: SaveSettingsStep.Idle,
layoutTrigger: SaveSettingsStep.Idle