Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

reducer.ts 1.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. import ReducerRegistry from '../base/redux/ReducerRegistry';
  2. import { assign } from '../base/redux/functions';
  3. import { MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED } from './actionTypes';
  4. export interface IOverlayState {
  5. browser?: string;
  6. isMediaPermissionPromptVisible?: boolean;
  7. }
  8. /**
  9. * Reduces the redux actions of the feature overlay.
  10. *
  11. * FIXME: these pieces of state should probably be in a different place.
  12. */
  13. ReducerRegistry.register<IOverlayState>('features/overlay', (state = {}, action): IOverlayState => {
  14. switch (action.type) {
  15. case MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED:
  16. return _mediaPermissionPromptVisibilityChanged(state, action);
  17. }
  18. return state;
  19. });
  20. /**
  21. * Reduces a specific redux action MEDIA_PERMISSION_PROMPT_VISIBILITY_CHANGED of
  22. * the feature overlay.
  23. *
  24. * @param {Object} state - The redux state of the feature overlay.
  25. * @param {Action} action - The redux action to reduce.
  26. * @private
  27. * @returns {Object} The new state of the feature overlay after the reduction of
  28. * the specified action.
  29. */
  30. function _mediaPermissionPromptVisibilityChanged(
  31. state: IOverlayState,
  32. { browser, isVisible }: { browser?: string; isVisible?: boolean; }) {
  33. return assign(state, {
  34. browser,
  35. isMediaPermissionPromptVisible: isVisible
  36. });
  37. }