plainblack/Lacuna-Web-Client

View on GitHub
app/js/stores/windows/mail.js

Summary

Maintainability
C
1 day
Test Coverage
'use strict';

var Reflux              = require('reflux');

var WindowMixinStore    = require('js/stores/mixins/window');

var MailWindowActions   = require('js/actions/windows/mail');
var KeyboardActions     = require('js/actions/keyboard');

var MailWindowStore = Reflux.createStore({
    mixins      : [WindowMixinStore],
    listenables : [MailWindowActions, KeyboardActions],

    getDefaultData : function() {
        return {
            show : false
        };
    },

    getData : function() {
        return this.state;
    },

    getInitialState : function() {
        if (! this.state) {
            this.state = this.getDefaultData();
        }
        return this.state;
    },

    init : function() {
        this.state = this.getDefaultData();
    },

    onMailWindowShow : function() {
        this.state.show = true;
        this.trigger(this.state);
    },

    onMailWindowHide : function() {
        this.state.show = false;
        this.trigger(this.state);
    }

});

module.exports = MailWindowStore;