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.

functions.web.ts 895B

1234567891011121314151617181920212223242526272829303132
  1. import { batch } from 'react-redux';
  2. import { IStore } from '../app/types';
  3. import { trackAdded } from '../base/tracks/actions.any';
  4. import { PREJOIN_INITIALIZED } from './actionTypes';
  5. import { setPrejoinDeviceErrors } from './actions.web';
  6. export * from './functions.any';
  7. /**
  8. * Adds all the newly created tracks to store on init.
  9. *
  10. * @param {Object[]} tracks - The newly created tracks.
  11. * @param {Object} errors - The errors from creating the tracks.
  12. * @param {Function} dispatch - The redux dispatch function.
  13. * @returns {void}
  14. */
  15. export function initPrejoin(tracks: Object[], errors: Object, dispatch?: IStore['dispatch']) {
  16. if (!dispatch) {
  17. return;
  18. }
  19. batch(() => {
  20. dispatch(setPrejoinDeviceErrors(errors));
  21. dispatch({
  22. type: PREJOIN_INITIALIZED
  23. });
  24. tracks.forEach(track => dispatch(trackAdded(track)));
  25. });
  26. }