Cleanup a bit of javascript

This commit is contained in:
the-djmaze 2023-02-21 12:59:56 +01:00
parent 0b8ec5c664
commit 938c209869
3 changed files with 54 additions and 48 deletions

View file

@ -6,6 +6,7 @@ import { i18n } from 'Common/Translator';
import { SettingsCapa } from 'Common/Globals';
import { ThemeStore, convertThemeName, changeTheme } from 'Stores/Theme';
import { addSubscribablesTo } from 'External/ko';
import Remote from 'Remote/User/Fetch';
@ -24,20 +25,22 @@ export class UserSettingsThemes /*extends AbstractViewSettings*/ {
this.fontSansSerif = ThemeStore.fontSansSerif;
this.fontSerif = ThemeStore.fontSerif;
this.fontMono = ThemeStore.fontMono;
ThemeStore.fontSansSerif.subscribe(value => {
Remote.saveSettings(null, {
fontSansSerif: value
});
});
ThemeStore.fontSerif.subscribe(value => {
Remote.saveSettings(null, {
fontSerif: value
});
});
ThemeStore.fontMono.subscribe(value => {
Remote.saveSettings(null, {
fontMono: value
});
addSubscribablesTo(ThemeStore, {
fontSansSerif: value => {
Remote.saveSettings(null, {
fontSansSerif: value
});
},
fontSerif: value => {
Remote.saveSettings(null, {
fontSerif: value
});
},
fontMono: value => {
Remote.saveSettings(null, {
fontMono: value
});
}
});
this.theme = ThemeStore.theme;