Browse Source

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 8 years ago
parent
commit
3033f7bc3d

+ 20
- 20
react/features/base/tracks/actionTypes.js View File

9
  */
9
  */
10
 export const TRACK_ADDED = Symbol('TRACK_ADDED');
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
  * The type of redux action dispatched when a canceled {@code getUserMedia}
13
  * The type of redux action dispatched when a canceled {@code getUserMedia}
34
  * process completes either successfully or with an error (the error is ignored
14
  * process completes either successfully or with an error (the error is ignored
73
  * }
53
  * }
74
  */
54
  */
75
 export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
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 View File

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

+ 5
- 5
react/features/base/tracks/reducer.js View File

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

Loading…
Cancel
Save