snappymail/dev/Stores/Theme.js
djmaze aeb5275648 Improved boot.js with existing global window.rl
Put dev/Storage/Settings.js in boots.js global rl.settings
2020-09-04 12:05:17 +02:00

23 lines
609 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();