Explorar el Código

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.
master
Lyubo Marinov hace 8 años
padre
commit
3033f7bc3d

+ 20
- 20
react/features/base/tracks/actionTypes.js Ver fichero

@@ -9,26 +9,6 @@
9 9
  */
10 10
 export const TRACK_ADDED = Symbol('TRACK_ADDED');
11 11
 
12
-/**
13
- * The type of redux action dispatched when a local track starts being created
14
- * via a WebRTC {@code getUserMedia} call. The action's payload includes an
15
- * extra {@code gumProcess} property which is a {@code Promise} with an extra
16
- * {@code cancel} method which can be used to cancel the process. Canceling will
17
- * result in disposing any {@code JitsiLocalTrack} returned by the
18
- * {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED}
19
- * action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action.
20
- *
21
- * {
22
- *     type: TRACK_BEING_CREATED
23
- *     track: {
24
- *         gumProcess: Promise with a `cancel` method to cancel the process,
25
- *         local: true,
26
- *         mediaType: MEDIA_TYPE
27
- *     }
28
- * }
29
- */
30
-export const TRACK_BEING_CREATED = Symbol('TRACK_BEING_CREATED');
31
-
32 12
 /**
33 13
  * The type of redux action dispatched when a canceled {@code getUserMedia}
34 14
  * process completes either successfully or with an error (the error is ignored
@@ -73,3 +53,23 @@ export const TRACK_REMOVED = Symbol('TRACK_REMOVED');
73 53
  * }
74 54
  */
75 55
 export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
56
+
57
+/**
58
+ * The type of redux action dispatched when a local track starts being created
59
+ * via a WebRTC {@code getUserMedia} call. The action's payload includes an
60
+ * extra {@code gumProcess} property which is a {@code Promise} with an extra
61
+ * {@code cancel} method which can be used to cancel the process. Canceling will
62
+ * result in disposing any {@code JitsiLocalTrack} returned by the
63
+ * {@code getUserMedia} callback. There will be a {@code TRACK_CREATE_CANCELED}
64
+ * action instead of a {@code TRACK_ADDED} or {@code TRACK_CREATE_ERROR} action.
65
+ *
66
+ * {
67
+ *     type: TRACK_WILL_CREATE
68
+ *     track: {
69
+ *         gumProcess: Promise with a `cancel` method to cancel the process,
70
+ *         local: true,
71
+ *         mediaType: MEDIA_TYPE
72
+ *     }
73
+ * }
74
+ */
75
+export const TRACK_WILL_CREATE = Symbol('TRACK_WILL_CREATE');

+ 3
- 3
react/features/base/tracks/actions.js Ver fichero

@@ -10,11 +10,11 @@ import { getLocalParticipant } from '../participants';
10 10
 
11 11
 import {
12 12
     TRACK_ADDED,
13
-    TRACK_BEING_CREATED,
14 13
     TRACK_CREATE_CANCELED,
15 14
     TRACK_CREATE_ERROR,
16 15
     TRACK_REMOVED,
17
-    TRACK_UPDATED
16
+    TRACK_UPDATED,
17
+    TRACK_WILL_CREATE
18 18
 } from './actionTypes';
19 19
 import { createLocalTracksF } from './functions';
20 20
 
@@ -138,7 +138,7 @@ export function createLocalTracksA(options = {}) {
138 138
             };
139 139
 
140 140
             dispatch({
141
-                type: TRACK_BEING_CREATED,
141
+                type: TRACK_WILL_CREATE,
142 142
                 track: {
143 143
                     gumProcess,
144 144
                     local: true,

+ 5
- 5
react/features/base/tracks/reducer.js Ver fichero

@@ -3,11 +3,11 @@ import { ReducerRegistry } from '../redux';
3 3
 
4 4
 import {
5 5
     TRACK_ADDED,
6
-    TRACK_BEING_CREATED,
7 6
     TRACK_CREATE_CANCELED,
8 7
     TRACK_CREATE_ERROR,
9 8
     TRACK_REMOVED,
10
-    TRACK_UPDATED
9
+    TRACK_UPDATED,
10
+    TRACK_WILL_CREATE
11 11
 } from './actionTypes';
12 12
 
13 13
 /**
@@ -101,9 +101,6 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
101 101
         return [ ...withoutTrackStub, action.track ];
102 102
     }
103 103
 
104
-    case TRACK_BEING_CREATED:
105
-        return [ ...state, action.track ];
106
-
107 104
     case TRACK_CREATE_CANCELED:
108 105
     case TRACK_CREATE_ERROR: {
109 106
         return state.filter(t => !t.local || t.mediaType !== action.trackType);
@@ -112,6 +109,9 @@ ReducerRegistry.register('features/base/tracks', (state = [], action) => {
112 109
     case TRACK_REMOVED:
113 110
         return state.filter(t => t.jitsiTrack !== action.track.jitsiTrack);
114 111
 
112
+    case TRACK_WILL_CREATE:
113
+        return [ ...state, action.track ];
114
+
115 115
     default:
116 116
         return state;
117 117
     }

Loading…
Cancelar
Guardar