You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

middleware.js 866B

12345678910111213141516171819202122232425262728293031323334353637
  1. /* @flow */
  2. import { hideAppSettings } from './actions';
  3. import { SET_ROOM } from '../base/conference';
  4. import { MiddlewareRegistry } from '../base/redux';
  5. /**
  6. * The Redux middleware to trigger settings screen show or hide
  7. * when necessary.
  8. *
  9. * @param {Store} store - The Redux store.
  10. * @returns {Function}
  11. */
  12. MiddlewareRegistry.register(store => next => action => {
  13. switch (action.type) {
  14. case SET_ROOM:
  15. return _closeAppSettings(store, next, action);
  16. }
  17. return next(action);
  18. });
  19. /**
  20. * Hides the settings screen.
  21. *
  22. * @param {Store} store - The redux store.
  23. * @param {Dispatch} next - The redux dispatch function.
  24. * @param {Action} action - The redux action.
  25. * @private
  26. * @returns {Object} The new state.
  27. */
  28. function _closeAppSettings(store, next, action) {
  29. store.dispatch(hideAppSettings());
  30. return next(action);
  31. }