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:
Lyubo Marinov 2017-11-15 09:23:22 -06:00
parent decf9c4991
commit 3033f7bc3d
3 changed files with 28 additions and 28 deletions

View File

@ -9,26 +9,6 @@
*/
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}
* 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');
/**
* 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');

View File

@ -10,11 +10,11 @@ import { getLocalParticipant } from '../participants';
import {
TRACK_ADDED,
TRACK_BEING_CREATED,
TRACK_CREATE_CANCELED,
TRACK_CREATE_ERROR,
TRACK_REMOVED,
TRACK_UPDATED
TRACK_UPDATED,
TRACK_WILL_CREATE
} from './actionTypes';
import { createLocalTracksF } from './functions';
@ -138,7 +138,7 @@ export function createLocalTracksA(options = {}) {
};
dispatch({
type: TRACK_BEING_CREATED,
type: TRACK_WILL_CREATE,
track: {
gumProcess,
local: true,

View File

@ -3,11 +3,11 @@ import { ReducerRegistry } from '../redux';
import {
TRACK_ADDED,
TRACK_BEING_CREATED,
TRACK_CREATE_CANCELED,
TRACK_CREATE_ERROR,
TRACK_REMOVED,
TRACK_UPDATED
TRACK_UPDATED,
TRACK_WILL_CREATE
} from './actionTypes';
/**
@ -101,9 +101,6 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
return [ ...withoutTrackStub, action.track ];
}
case TRACK_BEING_CREATED:
return [ ...state, action.track ];
case TRACK_CREATE_CANCELED:
case TRACK_CREATE_ERROR: {
return state.filter(t => !t.local || t.mediaType !== action.trackType);
@ -112,6 +109,9 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
case TRACK_REMOVED:
return state.filter(t => t.jitsiTrack !== action.track.jitsiTrack);
case TRACK_WILL_CREATE:
return [ ...state, action.track ];
default:
return state;
}