2016-08-17 06:01:20 +08:00
|
|
|
import ko from 'ko';
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
class ThemeStore {
|
2016-08-17 06:01:20 +08:00
|
|
|
constructor() {
|
|
|
|
this.themes = ko.observableArray([]);
|
|
|
|
this.themeBackgroundName = ko.observable('');
|
|
|
|
this.themeBackgroundHash = ko.observable('');
|
|
|
|
|
2019-07-05 03:19:24 +08:00
|
|
|
this.theme = ko.observable('').extend({ limitedList: this.themes });
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
populate() {
|
2020-09-04 18:05:17 +08:00
|
|
|
const Settings = rl.settings,
|
|
|
|
themes = Settings.app('themes');
|
2016-08-17 06:01:20 +08:00
|
|
|
|
2020-07-30 03:49:41 +08:00
|
|
|
this.themes(Array.isArray(themes) ? themes : []);
|
2020-09-04 18:05:17 +08:00
|
|
|
this.theme(Settings.get('Theme'));
|
|
|
|
this.themeBackgroundName(Settings.get('UserBackgroundName'));
|
|
|
|
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
|
2016-08-17 06:01:20 +08:00
|
|
|
}
|
2016-06-30 08:02:45 +08:00
|
|
|
}
|
2015-01-27 05:06:00 +08:00
|
|
|
|
2016-09-13 04:50:21 +08:00
|
|
|
export default new ThemeStore();
|