Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

reducer.ts 1.4KB

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