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.

reducer.js 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // @flow
  2. import { ReducerRegistry } from '../base/redux';
  3. import { UPDATE_LOCAL_TRACKS_DURATION } from './actionTypes';
  4. /**
  5. * Initial state.
  6. */
  7. const DEFAULT_STATE = {
  8. localTracksDuration: {
  9. audio: {
  10. startedTime: -1,
  11. value: 0
  12. },
  13. video: {
  14. camera: {
  15. startedTime: -1,
  16. value: 0
  17. },
  18. desktop: {
  19. startedTime: -1,
  20. value: 0
  21. }
  22. },
  23. conference: {
  24. startedTime: -1,
  25. value: 0
  26. }
  27. }
  28. };
  29. /**
  30. * Listen for actions which changes the state of the analytics feature.
  31. *
  32. * @param {Object} state - The Redux state of the feature features/analytics.
  33. * @param {Object} action - Action object.
  34. * @param {string} action.type - Type of action.
  35. * @returns {Object}
  36. */
  37. ReducerRegistry.register('features/analytics', (state = DEFAULT_STATE, action) => {
  38. switch (action.type) {
  39. case UPDATE_LOCAL_TRACKS_DURATION:
  40. return {
  41. ...state,
  42. localTracksDuration: action.localTracksDuration
  43. };
  44. default:
  45. return state;
  46. }
  47. });