snappymail/dev/Stores/Theme.js
djmaze b6f0b634fb Cleanup calls to Knockout observableArray
Improved Knockout observableArray
2021-01-22 12:23:20 +01:00

23 lines
607 B
JavaScript

import ko from 'ko';
class ThemeStore {
constructor() {
this.themes = ko.observableArray();
this.themeBackgroundName = ko.observable('');
this.themeBackgroundHash = ko.observable('');
this.theme = ko.observable('').extend({ limitedList: this.themes });
}
populate() {
const Settings = rl.settings,
themes = Settings.app('themes');
this.themes(Array.isArray(themes) ? themes : []);
this.theme(Settings.get('Theme'));
this.themeBackgroundName(Settings.get('UserBackgroundName'));
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
}
}
export default new ThemeStore();