aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/services/settings.js
blob: a79779afae2425d55862cd1003fde92940035586 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import Ember from 'ember';
import {themes} from '../utils/color-themes';

export default Ember.Service.extend({
  init() {
    this._super(...arguments);
    if(localStorage) {
      const colorThemeId = localStorage.getItem("colorThemeId");
      const colorTheme = themes[colorThemeId];
      if(colorThemeId) {
        this.set('colorTheme',colorTheme);
      }
    }
  },
  colorTheme : themes["darkTheme"],
  settingsObserver : Ember.observer("colorTheme",function() {
    if(localStorage) {      
      localStorage.setItem("colorThemeId",this.get('colorTheme').id);
    }
  })
});