1 import { AnyAction } from 'redux'; 2 3 import MiddlewareRegistry from '../base/redux/MiddlewareRegistry'; 4 5 import { PARTICIPANTS_PANE_CLOSE, PARTICIPANTS_PANE_OPEN } from './actionTypes'; 6 7 /** 8 * Middleware which intercepts participants pane actions. 9 * 10 * @param {IStore} store - The redux store. 11 * @returns {Function} 12 */ 13 MiddlewareRegistry.register(() => (next: Function) => (action: AnyAction) => { 14 switch (action.type) { 15 case PARTICIPANTS_PANE_OPEN: 16 if (typeof APP !== 'undefined') { 17 APP.API.notifyParticipantsPaneToggled(true); 18 } 19 break; 20 case PARTICIPANTS_PANE_CLOSE: 21 if (typeof APP !== 'undefined') { 22 APP.API.notifyParticipantsPaneToggled(false); 23 } 24 break; 25 } 26 27 return next(action); 28 });