Files
mattermost/webapp/stores/notification_store.jsx
Harrison Healey fb6f2a123c PLT-5860 Updated copyright date (#6058)
* PLT-5860 Updated copyright date in about modal

* PLT-5860 Updated copyright notice in JSX files

* PLT-5860 Updated copyright notice in go files

* Fixed misc copyright dates

* Fixed component snapshots
2017-04-12 08:27:57 -04:00

46 lines
1.1 KiB
JavaScript

// Copyright (c) 2016-present Mattermost, Inc. All Rights Reserved.
// See License.txt for license information.
import AppDispatcher from '../dispatcher/app_dispatcher.jsx';
import EventEmitter from 'events';
import Constants from 'utils/constants.jsx';
const ActionTypes = Constants.ActionTypes;
const CHANGE_EVENT = 'change';
class NotificationStoreClass extends EventEmitter {
emitChange() {
this.emit(CHANGE_EVENT);
}
addChangeListener(callback) {
this.on(CHANGE_EVENT, callback);
}
removeChangeListener(callback) {
this.removeListener(CHANGE_EVENT, callback);
}
setFocus(focus) {
this.inFocus = focus;
}
getFocus() {
return this.inFocus;
}
}
var NotificationStore = new NotificationStoreClass();
NotificationStore.dispatchToken = AppDispatcher.register((payload) => {
const action = payload.action;
switch (action.type) {
case ActionTypes.BROWSER_CHANGE_FOCUS:
NotificationStore.setFocus(action.focus);
break;
}
});
export default NotificationStore;