Coding style, consistency
We're already using the notion of _WILL_ in redux action types and there's currently no compelling reason to introduce _BEGIN_ as well.
This commit is contained in:
parent
decf9c4991
commit
3033f7bc3d
|
@ -9,26 +9,6 @@
|
||||||
*/
|
*/
|
||||||
export const TRACK_ADDED = Symbol('TRACK_ADDED');
|
export const TRACK_ADDED = Symbol('TRACK_ADDED');
|
||||||
|
|
||||||
/**
|
|
||||||
* The type of redux action dispatched when a local track starts being created
|
|
||||||
* via a WebRTC {@code getUserMedia} call. The action's payload includes an
|
|
||||||
* extra {@code gumProcess} property which is a {@code Promise} with an extra
|
|
||||||
* {@code cancel} method which can be used to cancel the process. Canceling will
|
|
||||||
* result in disposing any {@code JitsiLocalTrack} returned by the
|
|
||||||
* {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED}
|
|
||||||
* action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action.
|
|
||||||
*
|
|
||||||
* {
|
|
||||||
* type: TRACK_BEING_CREATED
|
|
||||||
* track: {
|
|
||||||
* gumProcess: Promise with a `cancel` method to cancel the process,
|
|
||||||
* local: true,
|
|
||||||
* mediaType: MEDIA_TYPE
|
|
||||||
* }
|
|
||||||
* }
|
|
||||||
*/
|
|
||||||
export const TRACK_BEING_CREATED = Symbol('TRACK_BEING_CREATED');
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of redux action dispatched when a canceled {@code getUserMedia}
|
* The type of redux action dispatched when a canceled {@code getUserMedia}
|
||||||
* process completes either successfully or with an error (the error is ignored
|
* process completes either successfully or with an error (the error is ignored
|
||||||
|
@ -73,3 +53,23 @@ export const TRACK_REMOVED = Symbol('TRACK_REMOVED');
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
|
export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The type of redux action dispatched when a local track starts being created
|
||||||
|
* via a WebRTC {@code getUserMedia} call. The action's payload includes an
|
||||||
|
* extra {@code gumProcess} property which is a {@code Promise} with an extra
|
||||||
|
* {@code cancel} method which can be used to cancel the process. Canceling will
|
||||||
|
* result in disposing any {@code JitsiLocalTrack} returned by the
|
||||||
|
* {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED}
|
||||||
|
* action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action.
|
||||||
|
*
|
||||||
|
* {
|
||||||
|
* type: TRACK_WILL_CREATE
|
||||||
|
* track: {
|
||||||
|
* gumProcess: Promise with a `cancel` method to cancel the process,
|
||||||
|
* local: true,
|
||||||
|
* mediaType: MEDIA_TYPE
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
|
export const TRACK_WILL_CREATE = Symbol('TRACK_WILL_CREATE');
|
||||||
|
|
|
@ -10,11 +10,11 @@ import { getLocalParticipant } from '../participants';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TRACK_ADDED,
|
TRACK_ADDED,
|
||||||
TRACK_BEING_CREATED,
|
|
||||||
TRACK_CREATE_CANCELED,
|
TRACK_CREATE_CANCELED,
|
||||||
TRACK_CREATE_ERROR,
|
TRACK_CREATE_ERROR,
|
||||||
TRACK_REMOVED,
|
TRACK_REMOVED,
|
||||||
TRACK_UPDATED
|
TRACK_UPDATED,
|
||||||
|
TRACK_WILL_CREATE
|
||||||
} from './actionTypes';
|
} from './actionTypes';
|
||||||
import { createLocalTracksF } from './functions';
|
import { createLocalTracksF } from './functions';
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ export function createLocalTracksA(options = {}) {
|
||||||
};
|
};
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TRACK_BEING_CREATED,
|
type: TRACK_WILL_CREATE,
|
||||||
track: {
|
track: {
|
||||||
gumProcess,
|
gumProcess,
|
||||||
local: true,
|
local: true,
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { ReducerRegistry } from '../redux';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
TRACK_ADDED,
|
TRACK_ADDED,
|
||||||
TRACK_BEING_CREATED,
|
|
||||||
TRACK_CREATE_CANCELED,
|
TRACK_CREATE_CANCELED,
|
||||||
TRACK_CREATE_ERROR,
|
TRACK_CREATE_ERROR,
|
||||||
TRACK_REMOVED,
|
TRACK_REMOVED,
|
||||||
TRACK_UPDATED
|
TRACK_UPDATED,
|
||||||
|
TRACK_WILL_CREATE
|
||||||
} from './actionTypes';
|
} from './actionTypes';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -101,9 +101,6 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
|
||||||
return [ ...withoutTrackStub, action.track ];
|
return [ ...withoutTrackStub, action.track ];
|
||||||
}
|
}
|
||||||
|
|
||||||
case TRACK_BEING_CREATED:
|
|
||||||
return [ ...state, action.track ];
|
|
||||||
|
|
||||||
case TRACK_CREATE_CANCELED:
|
case TRACK_CREATE_CANCELED:
|
||||||
case TRACK_CREATE_ERROR: {
|
case TRACK_CREATE_ERROR: {
|
||||||
return state.filter(t => !t.local || t.mediaType !== action.trackType);
|
return state.filter(t => !t.local || t.mediaType !== action.trackType);
|
||||||
|
@ -112,6 +109,9 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
|
||||||
case TRACK_REMOVED:
|
case TRACK_REMOVED:
|
||||||
return state.filter(t => t.jitsiTrack !== action.track.jitsiTrack);
|
return state.filter(t => t.jitsiTrack !== action.track.jitsiTrack);
|
||||||
|
|
||||||
|
case TRACK_WILL_CREATE:
|
||||||
|
return [ ...state, action.track ];
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue