aboutsummaryrefslogtreecommitdiff
path: root/javascript/app/services/settings.js
blob: 80808902ec357c1eb35f96d5f4b6b2ff70562972 (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);
    }
  })
});