snappymail/dev/Stores/Theme.js

27 lines
694 B
JavaScript
Raw Normal View History

import ko from 'ko';
import {isArray} from 'Common/Utils';
import * as Settings from 'Storage/Settings';
class ThemeStore
2016-06-30 08:02:45 +08:00
{
constructor() {
this.themes = ko.observableArray([]);
this.themeBackgroundName = ko.observable('');
this.themeBackgroundHash = ko.observable('');
this.theme = ko.observable('').extend({limitedList: this.themes});
}
populate() {
const themes = Settings.appSettingsGet('themes');
this.themes(isArray(themes) ? themes : []);
this.theme(Settings.settingsGet('Theme'));
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
}
2016-06-30 08:02:45 +08:00
}
export default new ThemeStore();