-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(prejoin): make initPrejoin sync.
- Loading branch information
1 parent
c602d77
commit ccf6c9a
Showing
7 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './functions.any'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { batch } from 'react-redux'; | ||
|
||
import { IStore } from '../app/types'; | ||
import { trackAdded } from '../base/tracks/actions.any'; | ||
|
||
import { PREJOIN_INITIALIZED } from './actionTypes'; | ||
import { setPrejoinDeviceErrors } from './actions.web'; | ||
|
||
export * from './functions.any'; | ||
|
||
/** | ||
* Adds all the newly created tracks to store on init. | ||
* | ||
* @param {Object[]} tracks - The newly created tracks. | ||
* @param {Object} errors - The errors from creating the tracks. | ||
* @param {Function} dispatch - The redux dispatch function. | ||
* @returns {void} | ||
*/ | ||
export function initPrejoin(tracks: Object[], errors: Object, dispatch?: IStore['dispatch']) { | ||
if (!dispatch) { | ||
return; | ||
} | ||
|
||
batch(() => { | ||
dispatch(setPrejoinDeviceErrors(errors)); | ||
dispatch({ | ||
type: PREJOIN_INITIALIZED | ||
}); | ||
|
||
tracks.forEach(track => dispatch(trackAdded(track))); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters