aboutsummaryrefslogtreecommitdiffstats
path: root/web/src/js/stores/settingstore.js
blob: 23ac6dca14145d6155bb7d5e8a2e3dac26994067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
function _SettingsStore() {
    EventEmitter.call(this);

    //FIXME: What do we do if we haven't requested anything from the server yet?
    this.settings = {
        version: "0.12",
        showEventLog: true,
        mode: "transparent",
    }; 
}
_.extend(_SettingsStore.prototype, EventEmitter.prototype, {
    getAll: function() {
        return this.settings;
    },
    handle: function(action) {
        switch (action.actionType) {
            case ActionTypes.SETTINGS_UPDATE:
                this.settings = action.settings;
                this.emit("change");
                break;
            default:
                return;
        }
    }
});

var SettingsStore = new _SettingsStore();
AppDispatcher.register(SettingsStore.handle.bind(SettingsStore));