Browse Source

Coding style: commends, formatting, sorting order

master
Lyubo Marinov 7 years ago
parent
commit
22ce001f14

+ 97
- 94
react/features/base/conference/middleware.js View File

53
  */
53
  */
54
 MiddlewareRegistry.register(store => next => action => {
54
 MiddlewareRegistry.register(store => next => action => {
55
     switch (action.type) {
55
     switch (action.type) {
56
-    case CONNECTION_ESTABLISHED:
57
-        return _connectionEstablished(store, next, action);
58
-
59
     case CONFERENCE_FAILED:
56
     case CONFERENCE_FAILED:
60
-        return _conferenceFailed(next, action);
57
+        return _conferenceFailed(store, next, action);
61
 
58
 
62
     case CONFERENCE_JOINED:
59
     case CONFERENCE_JOINED:
63
         return _conferenceJoined(store, next, action);
60
         return _conferenceJoined(store, next, action);
64
 
61
 
62
+    case CONNECTION_ESTABLISHED:
63
+        return _connectionEstablished(store, next, action);
64
+
65
     case DATA_CHANNEL_OPENED:
65
     case DATA_CHANNEL_OPENED:
66
         return _syncReceiveVideoQuality(store, next, action);
66
         return _syncReceiveVideoQuality(store, next, action);
67
 
67
 
88
     return next(action);
88
     return next(action);
89
 });
89
 });
90
 
90
 
91
-/**
92
- * Notifies the feature base/conference that the action CONNECTION_ESTABLISHED
93
- * is being dispatched within a specific redux store.
94
- *
95
- * @param {Store} store - The redux store in which the specified action is being
96
- * dispatched.
97
- * @param {Dispatch} next - The redux dispatch function to dispatch the
98
- * specified action to the specified store.
99
- * @param {Action} action - The redux action CONNECTION_ESTABLISHED which is
100
- * being dispatched in the specified store.
101
- * @private
102
- * @returns {Object} The value returned by {@code next(action)}.
103
- */
104
-function _connectionEstablished({ dispatch }, next, action) {
105
-    const result = next(action);
106
-
107
-    // FIXME: workaround for the web version. Currently the creation of the
108
-    // conference is handled by /conference.js
109
-    if (typeof APP === 'undefined') {
110
-        dispatch(createConference());
111
-    }
112
-
113
-    return result;
114
-}
115
-
116
 /**
91
 /**
117
  * Makes sure to leave a failed conference in order to release any allocated
92
  * Makes sure to leave a failed conference in order to release any allocated
118
- * resources like peerconnections, emit participant left events etc.
93
+ * resources like peer connections, emit participant left events, etc.
119
  *
94
  *
120
- * @param {Dispatch} next - The redux dispatch function to dispatch the
121
- * specified action to the specified store.
122
- * @param {Action} action - The redux action CONFERENCE_FAILED which is being
123
- * dispatched in the specified store.
95
+ * @param {Store} store - The redux store in which the specified {@code action}
96
+ * is being dispatched.
97
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
98
+ * specified {@code action} to the specified {@code store}.
99
+ * @param {Action} action - The redux action {@code CONFERENCE_FAILED} which is
100
+ * being dispatched in the specified {@code store}.
124
  * @private
101
  * @private
125
  * @returns {Object} The value returned by {@code next(action)}.
102
  * @returns {Object} The value returned by {@code next(action)}.
126
  */
103
  */
127
-function _conferenceFailed(next, action) {
104
+function _conferenceFailed(store, next, action) {
128
     const result = next(action);
105
     const result = next(action);
106
+
107
+    // XXX After next(action), it is clear whether the error is recoverable.
129
     const { conference, error } = action;
108
     const { conference, error } = action;
130
 
109
 
131
     !error.recoverable
110
     !error.recoverable
132
         && conference
111
         && conference
133
-        && conference.leave().catch(leaveError => {
134
-            // Even though we don't care too much about the failure it may be
135
-            // good to now that it happen, so log it on the info level.
136
-            logger.info(
137
-                'There was an error leaving a failed conference: ', leaveError);
112
+        && conference.leave().catch(reason => {
113
+            // Even though we don't care too much about the failure, it may be
114
+            // good to know that it happen, so log it (on the info level).
115
+            logger.info('JitsiConference.leave() rejected with:', reason);
138
         });
116
         });
139
 
117
 
140
     return result;
118
     return result;
144
  * Does extra sync up on properties that may need to be updated after the
122
  * Does extra sync up on properties that may need to be updated after the
145
  * conference was joined.
123
  * conference was joined.
146
  *
124
  *
147
- * @param {Store} store - The redux store in which the specified action is being
148
- * dispatched.
149
- * @param {Dispatch} next - The redux dispatch function to dispatch the
150
- * specified action to the specified store.
151
- * @param {Action} action - The redux action CONFERENCE_JOINED which is being
152
- * dispatched in the specified store.
125
+ * @param {Store} store - The redux store in which the specified {@code action}
126
+ * is being dispatched.
127
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
128
+ * specified {@code action} to the specified {@code store}.
129
+ * @param {Action} action - The redux action {@code CONFERENCE_JOINED} which is
130
+ * being dispatched in the specified {@code store}.
153
  * @private
131
  * @private
154
  * @returns {Object} The value returned by {@code next(action)}.
132
  * @returns {Object} The value returned by {@code next(action)}.
155
  */
133
  */
161
     // FIXME On Web the audio only mode for "start audio only" is toggled before
139
     // FIXME On Web the audio only mode for "start audio only" is toggled before
162
     // conference is added to the redux store ("on conference joined" action)
140
     // conference is added to the redux store ("on conference joined" action)
163
     // and the LastN value needs to be synchronized here.
141
     // and the LastN value needs to be synchronized here.
164
-    audioOnly && (conference.getLastN() !== 0) && dispatch(setLastN(0));
142
+    audioOnly && conference.getLastN() !== 0 && dispatch(setLastN(0));
143
+
144
+    return result;
145
+}
146
+
147
+/**
148
+ * Notifies the feature base/conference that the action
149
+ * {@code CONNECTION_ESTABLISHED} is being dispatched within a specific redux
150
+ * store.
151
+ *
152
+ * @param {Store} store - The redux store in which the specified {@code action}
153
+ * is being dispatched.
154
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
155
+ * specified {@code action} to the specified {@code store}.
156
+ * @param {Action} action - The redux action {@code CONNECTION_ESTABLISHED}
157
+ * which is being dispatched in the specified {@code store}.
158
+ * @private
159
+ * @returns {Object} The value returned by {@code next(action)}.
160
+ */
161
+function _connectionEstablished({ dispatch }, next, action) {
162
+    const result = next(action);
163
+
164
+    // FIXME: Workaround for the web version. Currently, the creation of the
165
+    // conference is handled by /conference.js.
166
+    typeof APP === 'undefined' && dispatch(createConference());
165
 
167
 
166
     return result;
168
     return result;
167
 }
169
 }
168
 
170
 
169
 /**
171
 /**
170
- * Notifies the feature base/conference that the action PIN_PARTICIPANT is being
171
- * dispatched within a specific redux store. Pins the specified remote
172
+ * Notifies the feature base/conference that the action {@code PIN_PARTICIPANT}
173
+ * is being dispatched within a specific redux store. Pins the specified remote
172
  * participant in the associated conference, ignores the local participant.
174
  * participant in the associated conference, ignores the local participant.
173
  *
175
  *
174
- * @param {Store} store - The redux store in which the specified action is being
175
- * dispatched.
176
- * @param {Dispatch} next - The redux dispatch function to dispatch the
177
- * specified action to the specified store.
178
- * @param {Action} action - The redux action PIN_PARTICIPANT which is being
179
- * dispatched in the specified store.
176
+ * @param {Store} store - The redux store in which the specified {@code action}
177
+ * is being dispatched.
178
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
179
+ * specified {@code action} to the specified {@code store}.
180
+ * @param {Action} action - The redux action {@code PIN_PARTICIPANT} which is
181
+ * being dispatched in the specified {@code store}.
180
  * @private
182
  * @private
181
  * @returns {Object} The value returned by {@code next(action)}.
183
  * @returns {Object} The value returned by {@code next(action)}.
182
  */
184
  */
239
  * Sets the audio-only flag for the current conference. When audio-only is set,
241
  * Sets the audio-only flag for the current conference. When audio-only is set,
240
  * local video is muted and last N is set to 0 to avoid receiving remote video.
242
  * local video is muted and last N is set to 0 to avoid receiving remote video.
241
  *
243
  *
242
- * @param {Store} store - The redux store in which the specified action is being
243
- * dispatched.
244
- * @param {Dispatch} next - The redux dispatch function to dispatch the
245
- * specified action to the specified store.
246
- * @param {Action} action - The redux action SET_AUDIO_ONLY which is being
247
- * dispatched in the specified store.
244
+ * @param {Store} store - The redux store in which the specified {@code action}
245
+ * is being dispatched.
246
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
247
+ * specified {@code action} to the specified {@code store}.
248
+ * @param {Action} action - The redux action {@code SET_AUDIO_ONLY} which is
249
+ * being dispatched in the specified {@code store}.
248
  * @private
250
  * @private
249
  * @returns {Object} The value returned by {@code next(action)}.
251
  * @returns {Object} The value returned by {@code next(action)}.
250
  */
252
  */
274
             /* ensureTrack */ true));
276
             /* ensureTrack */ true));
275
 
277
 
276
     if (typeof APP !== 'undefined') {
278
     if (typeof APP !== 'undefined') {
277
-        // TODO This should be a temporary solution that lasts only until
278
-        // video tracks and all ui is moved into react/redux on the web.
279
+        // TODO This should be a temporary solution that lasts only until video
280
+        // tracks and all ui is moved into react/redux on the web.
279
         APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, newValue);
281
         APP.UI.emitEvent(UIEvents.TOGGLE_AUDIO_ONLY, newValue);
280
     }
282
     }
281
 
283
 
285
 /**
287
 /**
286
  * Sets the last N (value) of the video channel in the conference.
288
  * Sets the last N (value) of the video channel in the conference.
287
  *
289
  *
288
- * @param {Store} store - The redux store in which the specified action is being
289
- * dispatched.
290
- * @param {Dispatch} next - The redux dispatch function to dispatch the
291
- * specified action to the specified store.
292
- * @param {Action} action - The redux action SET_LASTN which is being dispatched
293
- * in the specified store.
290
+ * @param {Store} store - The redux store in which the specified {@code action}
291
+ * is being dispatched.
292
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
293
+ * specified {@code action} to the specified {@code store}.
294
+ * @param {Action} action - The redux action {@code SET_LASTN} which is being
295
+ * dispatched in the specified {@code store}.
294
  * @private
296
  * @private
295
  * @returns {Object} The value returned by {@code next(action)}.
297
  * @returns {Object} The value returned by {@code next(action)}.
296
  */
298
  */
312
  * Sets the maximum receive video quality and will turn off audio only mode if
314
  * Sets the maximum receive video quality and will turn off audio only mode if
313
  * enabled.
315
  * enabled.
314
  *
316
  *
315
- * @param {Store} store - The redux store in which the specified action is being
316
- * dispatched.
317
- * @param {Dispatch} next - The redux dispatch function to dispatch the
318
- * specified action to the specified store.
319
- * @param {Action} action - The redux action SET_RECEIVE_VIDEO_QUALITY which is
320
- * being dispatched in the specified store.
317
+ * @param {Store} store - The redux store in which the specified {@code action}
318
+ * is being dispatched.
319
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
320
+ * specified {@code action} to the specified {@code store}.
321
+ * @param {Action} action - The redux action {@code SET_RECEIVE_VIDEO_QUALITY}
322
+ * which is being dispatched in the specified {@code store}.
321
  * @private
323
  * @private
322
  * @returns {Object} The value returned by {@code next(action)}.
324
  * @returns {Object} The value returned by {@code next(action)}.
323
  */
325
  */
336
  * Notifies the feature {@code base/conference} that the redix action
338
  * Notifies the feature {@code base/conference} that the redix action
337
  * {@link SET_ROOM} is being dispatched within a specific redux store.
339
  * {@link SET_ROOM} is being dispatched within a specific redux store.
338
  *
340
  *
339
- * @param {Store} store - The redux store in which the specified action is being
340
- * dispatched.
341
- * @param {Dispatch} next - The redux dispatch function to dispatch the
342
- * specified action to the specified store.
341
+ * @param {Store} store - The redux store in which the specified {@code action}
342
+ * is being dispatched.
343
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
344
+ * specified {@code action} to the specified {@code store}.
343
  * @param {Action} action - The redux action {@code SET_ROOM} which is being
345
  * @param {Action} action - The redux action {@code SET_ROOM} which is being
344
- * dispatched in the specified store.
346
+ * dispatched in the specified {@code store}.
345
  * @private
347
  * @private
346
  * @returns {Object} The value returned by {@code next(action)}.
348
  * @returns {Object} The value returned by {@code next(action)}.
347
  */
349
  */
420
 /**
422
 /**
421
  * Sets the maximum receive video quality.
423
  * Sets the maximum receive video quality.
422
  *
424
  *
423
- * @param {Store} store - The redux store in which the specified action is being
424
- * dispatched.
425
- * @param {Dispatch} next - The redux dispatch function to dispatch the
426
- * specified action to the specified store.
427
- * @param {Action} action - The redux action DATA_CHANNEL_STATUS_CHANGED which
428
- * is being dispatched in the specified store.
425
+ * @param {Store} store - The redux store in which the specified {@code action}
426
+ * is being dispatched.
427
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
428
+ * specified {@code action} to the specified {@code store}.
429
+ * @param {Action} action - The redux action {@code DATA_CHANNEL_STATUS_CHANGED}
430
+ * which is being dispatched in the specified {@code store}.
429
  * @private
431
  * @private
430
  * @returns {Object} The value returned by {@code next(action)}.
432
  * @returns {Object} The value returned by {@code next(action)}.
431
  */
433
  */
438
 }
440
 }
439
 
441
 
440
 /**
442
 /**
441
- * Notifies the feature base/conference that the action TRACK_ADDED
442
- * or TRACK_REMOVED is being dispatched within a specific redux store.
443
+ * Notifies the feature base/conference that the action {@code TRACK_ADDED}
444
+ * or {@code TRACK_REMOVED} is being dispatched within a specific redux store.
443
  *
445
  *
444
- * @param {Store} store - The redux store in which the specified action is being
445
- * dispatched.
446
- * @param {Dispatch} next - The redux dispatch function to dispatch the
447
- * specified action to the specified store.
448
- * @param {Action} action - The redux action TRACK_ADDED or TRACK_REMOVED which
449
- * is being dispatched in the specified store.
446
+ * @param {Store} store - The redux store in which the specified {@code action}
447
+ * is being dispatched.
448
+ * @param {Dispatch} next - The redux {@code dispatch} function to dispatch the
449
+ * specified {@code action} to the specified {@code store}.
450
+ * @param {Action} action - The redux action {@code TRACK_ADDED} or
451
+ * {@code TRACK_REMOVED} which is being dispatched in the specified
452
+ * {@code store}.
450
  * @private
453
  * @private
451
  * @returns {Object} The value returned by {@code next(action)}.
454
  * @returns {Object} The value returned by {@code next(action)}.
452
  */
455
  */

+ 28
- 25
react/features/base/connection/actions.native.js View File

62
      * Indicates whether this event is recoverable or not.
62
      * Indicates whether this event is recoverable or not.
63
      */
63
      */
64
     recoverable?: boolean
64
     recoverable?: boolean
65
-}
65
+};
66
 
66
 
67
 /**
67
 /**
68
  * Opens new connection.
68
  * Opens new connection.
100
         });
100
         });
101
 
101
 
102
         /**
102
         /**
103
-         * Dispatches CONNECTION_DISCONNECTED action when connection is
103
+         * Dispatches {@code CONNECTION_DISCONNECTED} action when connection is
104
          * disconnected.
104
          * disconnected.
105
          *
105
          *
106
          * @param {string} message - Disconnect reason.
106
          * @param {string} message - Disconnect reason.
153
         }
153
         }
154
 
154
 
155
         /**
155
         /**
156
-         * Unsubscribes connection instance from CONNECTION_ESTABLISHED
157
-         * and CONNECTION_FAILED events.
156
+         * Unsubscribes connection instance from {@code CONNECTION_ESTABLISHED}
157
+         * and {@code CONNECTION_FAILED} events.
158
          *
158
          *
159
          * @returns {void}
159
          * @returns {void}
160
          */
160
          */
172
 /**
172
 /**
173
  * Create an action for when the signaling connection has been lost.
173
  * Create an action for when the signaling connection has been lost.
174
  *
174
  *
175
- * @param {JitsiConnection} connection - The JitsiConnection which disconnected.
175
+ * @param {JitsiConnection} connection - The {@code JitsiConnection} which
176
+ * disconnected.
176
  * @param {string} message - Error message.
177
  * @param {string} message - Error message.
177
  * @private
178
  * @private
178
  * @returns {{
179
  * @returns {{
189
     };
190
     };
190
 }
191
 }
191
 
192
 
192
-/**
193
- * Create an action for when a connection will connect.
194
- *
195
- * @param {JitsiConnection} connection - The JitsiConnection which will connect.
196
- * @private
197
- * @returns {{
198
- *     type: CONNECTION_WILL_CONNECT,
199
- *     connection: JitsiConnection
200
- * }}
201
- */
202
-function _connectionWillConnect(connection) {
203
-    return {
204
-        type: CONNECTION_WILL_CONNECT,
205
-        connection
206
-    };
207
-}
208
-
209
 /**
193
 /**
210
  * Create an action for when the signaling connection has been established.
194
  * Create an action for when the signaling connection has been established.
211
  *
195
  *
212
- * @param {JitsiConnection} connection - The JitsiConnection which was
196
+ * @param {JitsiConnection} connection - The {@code JitsiConnection} which was
213
  * established.
197
  * established.
214
  * @public
198
  * @public
215
  * @returns {{
199
  * @returns {{
227
 /**
211
 /**
228
  * Create an action for when the signaling connection could not be created.
212
  * Create an action for when the signaling connection could not be created.
229
  *
213
  *
230
- * @param {JitsiConnection} connection - The JitsiConnection which failed.
214
+ * @param {JitsiConnection} connection - The {@code JitsiConnection} which
215
+ * failed.
231
  * @param {ConnectionFailedError} error - Error.
216
  * @param {ConnectionFailedError} error - Error.
232
  * @public
217
  * @public
233
  * @returns {{
218
  * @returns {{
252
     };
237
     };
253
 }
238
 }
254
 
239
 
240
+/**
241
+ * Create an action for when a connection will connect.
242
+ *
243
+ * @param {JitsiConnection} connection - The {@code JitsiConnection} which will
244
+ * connect.
245
+ * @private
246
+ * @returns {{
247
+ *     type: CONNECTION_WILL_CONNECT,
248
+ *     connection: JitsiConnection
249
+ * }}
250
+ */
251
+function _connectionWillConnect(connection) {
252
+    return {
253
+        type: CONNECTION_WILL_CONNECT,
254
+        connection
255
+    };
256
+}
257
+
255
 /**
258
 /**
256
  * Constructs options to be passed to the constructor of {@code JitsiConnection}
259
  * Constructs options to be passed to the constructor of {@code JitsiConnection}
257
  * based on the redux state.
260
  * based on the redux state.
326
                 = conference_.leave()
329
                 = conference_.leave()
327
                     .catch(error => {
330
                     .catch(error => {
328
                         logger.warn(
331
                         logger.warn(
329
-                            'JitsiConference.leave() rejected with: ',
332
+                            'JitsiConference.leave() rejected with:',
330
                             error);
333
                             error);
331
 
334
 
332
                         // The library lib-jitsi-meet failed to make the
335
                         // The library lib-jitsi-meet failed to make the

Loading…
Cancel
Save