mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* 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
46 lines
1.1 KiB
JavaScript
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;
|