Explorar el Código

Consistent naming of functions

Until we make a decision on access modifier hints and adopt a respective
coding style, consistency is king.
j8
Lyubomir Marinov hace 8 años
padre
commit
349c04d8d1

+ 8
- 8
react/features/audio-mode/middleware.js Ver fichero

22
     // The react-native module AudioMode is implemented on iOS at the time of
22
     // The react-native module AudioMode is implemented on iOS at the time of
23
     // this writing.
23
     // this writing.
24
     if (AudioMode) {
24
     if (AudioMode) {
25
-        let audioMode;
25
+        let mode;
26
 
26
 
27
         switch (action.type) {
27
         switch (action.type) {
28
         case APP_WILL_MOUNT:
28
         case APP_WILL_MOUNT:
29
         case CONFERENCE_FAILED:
29
         case CONFERENCE_FAILED:
30
         case CONFERENCE_LEFT:
30
         case CONFERENCE_LEFT:
31
-            audioMode = AudioMode.DEFAULT;
31
+            mode = AudioMode.DEFAULT;
32
             break;
32
             break;
33
 
33
 
34
         case CONFERENCE_WILL_JOIN: {
34
         case CONFERENCE_WILL_JOIN: {
35
             const conference = store.getState()['features/base/conference'];
35
             const conference = store.getState()['features/base/conference'];
36
 
36
 
37
-            audioMode
37
+            mode
38
                 = conference.audioOnly
38
                 = conference.audioOnly
39
                     ? AudioMode.AUDIO_CALL
39
                     ? AudioMode.AUDIO_CALL
40
                     : AudioMode.VIDEO_CALL;
40
                     : AudioMode.VIDEO_CALL;
42
         }
42
         }
43
 
43
 
44
         default:
44
         default:
45
-            audioMode = null;
45
+            mode = null;
46
             break;
46
             break;
47
         }
47
         }
48
 
48
 
49
-        if (audioMode !== null) {
50
-            AudioMode.setMode(audioMode).catch(err => {
51
-                console.error(`Failed to set audio mode ${audioMode}: ${err}`);
52
-            });
49
+        if (mode !== null) {
50
+            AudioMode.setMode(mode)
51
+                .catch(err =>
52
+                    console.error(`Failed to set audio mode ${mode}: ${err}`));
53
         }
53
         }
54
     }
54
     }
55
 
55
 

+ 6
- 0
react/features/base/lib-jitsi-meet/native/RTCPeerConnection.js Ver fichero

106
 /**
106
 /**
107
  * Logs at error level.
107
  * Logs at error level.
108
  *
108
  *
109
+ * @private
109
  * @returns {void}
110
  * @returns {void}
110
  */
111
  */
111
 function _LOGE(...args) {
112
 function _LOGE(...args) {
119
  *
120
  *
120
  * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
121
  * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
121
  * which specifies the configuration of the remote end of the connection.
122
  * which specifies the configuration of the remote end of the connection.
123
+ * @private
124
+ * @private
122
  * @returns {Promise}
125
  * @returns {Promise}
123
  */
126
  */
124
 function _setRemoteDescription(sessionDescription) {
127
 function _setRemoteDescription(sessionDescription) {
160
  *
163
  *
161
  * @param {RTCSessionDescription} sdp - The RTCSessionDescription which
164
  * @param {RTCSessionDescription} sdp - The RTCSessionDescription which
162
  * specifies the configuration of the remote end of the connection.
165
  * specifies the configuration of the remote end of the connection.
166
+ * @private
163
  * @returns {Promise}
167
  * @returns {Promise}
164
  */
168
  */
165
 function _synthesizeIPv6Addresses(sdp) {
169
 function _synthesizeIPv6Addresses(sdp) {
184
  *
188
  *
185
  * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
189
  * @param {RTCSessionDescription} sessionDescription - The RTCSessionDescription
186
  * for which IPv6 addresses will be synthesized.
190
  * for which IPv6 addresses will be synthesized.
191
+ * @private
187
  * @returns {{
192
  * @returns {{
188
  *     ips: Map,
193
  *     ips: Map,
189
  *     lines: Array
194
  *     lines: Array
278
  * @param {Map} ips - A Map of IPv4 addresses found in the specified
283
  * @param {Map} ips - A Map of IPv4 addresses found in the specified
279
  * sessionDescription to synthesized IPv6 addresses.
284
  * sessionDescription to synthesized IPv6 addresses.
280
  * @param {Array} lines - The lines of the specified sessionDescription.
285
  * @param {Array} lines - The lines of the specified sessionDescription.
286
+ * @private
281
  * @returns {RTCSessionDescription} A RTCSessionDescription that represents the
287
  * @returns {RTCSessionDescription} A RTCSessionDescription that represents the
282
  * result of the synthesis of IPv6 addresses.
288
  * result of the synthesis of IPv6 addresses.
283
  */
289
  */

+ 3
- 2
react/features/base/media/components/native/VideoTrack.js Ver fichero

140
 
140
 
141
     // eslint-disable-next-line valid-jsdoc
141
     // eslint-disable-next-line valid-jsdoc
142
     /**
142
     /**
143
-     * @inheritdoc
144
-     *
145
      * Animate the setting of the video track to be rendered by this instance.
143
      * Animate the setting of the video track to be rendered by this instance.
144
+     *
145
+     * @inheritdoc
146
+     * @protected
146
      */
147
      */
147
     _setVideoTrack(videoTrack) {
148
     _setVideoTrack(videoTrack) {
148
         // If JitsiTrack instance didn't change, that means some other track's
149
         // If JitsiTrack instance didn't change, that means some other track's

+ 6
- 4
react/features/base/media/middleware.js Ver fichero

21
 
21
 
22
     switch (action.type) {
22
     switch (action.type) {
23
     case CONFERENCE_LEFT:
23
     case CONFERENCE_LEFT:
24
-        resetInitialMediaState(store);
24
+        _resetInitialMediaState(store);
25
         break;
25
         break;
26
 
26
 
27
     case TRACK_ADDED:
27
     case TRACK_ADDED:
28
-        action.track.local && syncTrackMutedState(store, action.track);
28
+        action.track.local && _syncTrackMutedState(store, action.track);
29
         break;
29
         break;
30
     }
30
     }
31
 
31
 
36
  * Resets initial media state.
36
  * Resets initial media state.
37
  *
37
  *
38
  * @param {Store} store - Redux store.
38
  * @param {Store} store - Redux store.
39
+ * @private
39
  * @returns {void}
40
  * @returns {void}
40
  */
41
  */
41
-function resetInitialMediaState(store) {
42
+function _resetInitialMediaState(store) {
42
     const { dispatch, getState } = store;
43
     const { dispatch, getState } = store;
43
     const state = getState()['features/base/media'];
44
     const state = getState()['features/base/media'];
44
 
45
 
53
  *
54
  *
54
  * @param {Store} store - Redux store.
55
  * @param {Store} store - Redux store.
55
  * @param {Track} track - Local media track.
56
  * @param {Track} track - Local media track.
57
+ * @private
56
  * @returns {void}
58
  * @returns {void}
57
  */
59
  */
58
-function syncTrackMutedState(store, track) {
60
+function _syncTrackMutedState(store, track) {
59
     const state = store.getState()['features/base/media'];
61
     const state = store.getState()['features/base/media'];
60
     const muted = state[track.mediaType].muted;
62
     const muted = state[track.mediaType].muted;
61
 
63
 

+ 6
- 4
react/features/base/media/reducer.js Ver fichero

31
  * @param {AudioMediaState} state - Media state of local audio.
31
  * @param {AudioMediaState} state - Media state of local audio.
32
  * @param {Object} action - Action object.
32
  * @param {Object} action - Action object.
33
  * @param {string} action.type - Type of action.
33
  * @param {string} action.type - Type of action.
34
+ * @private
34
  * @returns {AudioMediaState}
35
  * @returns {AudioMediaState}
35
  */
36
  */
36
-function audio(state = AUDIO_INITIAL_MEDIA_STATE, action) {
37
+function _audio(state = AUDIO_INITIAL_MEDIA_STATE, action) {
37
     switch (action.type) {
38
     switch (action.type) {
38
     case SET_AUDIO_MUTED:
39
     case SET_AUDIO_MUTED:
39
         return {
40
         return {
70
  * @param {VideoMediaState} state - Media state of local video.
71
  * @param {VideoMediaState} state - Media state of local video.
71
  * @param {Object} action - Action object.
72
  * @param {Object} action - Action object.
72
  * @param {string} action.type - Type of action.
73
  * @param {string} action.type - Type of action.
74
+ * @private
73
  * @returns {VideoMediaState}
75
  * @returns {VideoMediaState}
74
  */
76
  */
75
-function video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
77
+function _video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
76
     switch (action.type) {
78
     switch (action.type) {
77
     case SET_CAMERA_FACING_MODE:
79
     case SET_CAMERA_FACING_MODE:
78
         return {
80
         return {
102
  * @returns {Object}
104
  * @returns {Object}
103
  */
105
  */
104
 ReducerRegistry.register('features/base/media', combineReducers({
106
 ReducerRegistry.register('features/base/media', combineReducers({
105
-    audio,
106
-    video
107
+    audio: _audio,
108
+    video: _video
107
 }));
109
 }));

+ 5
- 5
react/features/base/navigator/RouteRegistry.js Ver fichero

20
          *
20
          *
21
          * @private
21
          * @private
22
          */
22
          */
23
-        this._routeRegistry = new Set();
23
+        this._elements = new Set();
24
     }
24
     }
25
 
25
 
26
     /**
26
     /**
57
         // We use the destructuring operator to 'clone' the route object to
57
         // We use the destructuring operator to 'clone' the route object to
58
         // prevent modifications from outside (e.g. React Native's Navigator
58
         // prevent modifications from outside (e.g. React Native's Navigator
59
         // extends it with additional properties).
59
         // extends it with additional properties).
60
-        return [ ...this._routeRegistry ].map(r => {
60
+        return [ ...this._elements ].map(r => {
61
             return { ...r };
61
             return { ...r };
62
         });
62
         });
63
     }
63
     }
71
      */
71
      */
72
     getRouteByComponent(component) {
72
     getRouteByComponent(component) {
73
         const route
73
         const route
74
-            = [ ...this._routeRegistry ].find(r => r.component === component);
74
+            = [ ...this._elements ].find(r => r.component === component);
75
 
75
 
76
         // We use destructuring operator to 'clone' route object to prevent
76
         // We use destructuring operator to 'clone' route object to prevent
77
         // modifications from outside (e.g. React Native's Navigator extends
77
         // modifications from outside (e.g. React Native's Navigator extends
86
      * @returns {void}
86
      * @returns {void}
87
      */
87
      */
88
     register(route) {
88
     register(route) {
89
-        if (this._routeRegistry.has(route)) {
89
+        if (this._elements.has(route)) {
90
             throw new Error(`Route ${route.component} is registered already!`);
90
             throw new Error(`Route ${route.component} is registered already!`);
91
         }
91
         }
92
 
92
 
93
-        this._routeRegistry.add(route);
93
+        this._elements.add(route);
94
     }
94
     }
95
 }
95
 }
96
 
96
 

+ 4
- 3
react/features/base/participants/reducer.js Ver fichero

48
  * @param {Participant} action.participant - Information about participant to be
48
  * @param {Participant} action.participant - Information about participant to be
49
  * added/modified.
49
  * added/modified.
50
  * @param {JitsiConference} action.conference - Conference instance.
50
  * @param {JitsiConference} action.conference - Conference instance.
51
+ * @private
51
  * @returns {Participant|undefined}
52
  * @returns {Participant|undefined}
52
  */
53
  */
53
-function participant(state, action) {
54
+function _participant(state, action) {
54
     switch (action.type) {
55
     switch (action.type) {
55
     case DOMINANT_SPEAKER_CHANGED:
56
     case DOMINANT_SPEAKER_CHANGED:
56
         // Only one dominant speaker is allowed.
57
         // Only one dominant speaker is allowed.
146
 ReducerRegistry.register('features/base/participants', (state = [], action) => {
147
 ReducerRegistry.register('features/base/participants', (state = [], action) => {
147
     switch (action.type) {
148
     switch (action.type) {
148
     case PARTICIPANT_JOINED:
149
     case PARTICIPANT_JOINED:
149
-        return [ ...state, participant(undefined, action) ];
150
+        return [ ...state, _participant(undefined, action) ];
150
 
151
 
151
     case PARTICIPANT_LEFT:
152
     case PARTICIPANT_LEFT:
152
         return state.filter(p => p.id !== action.participant.id);
153
         return state.filter(p => p.id !== action.participant.id);
155
     case PARTICIPANT_ID_CHANGED:
156
     case PARTICIPANT_ID_CHANGED:
156
     case PARTICIPANT_UPDATED:
157
     case PARTICIPANT_UPDATED:
157
     case PIN_PARTICIPANT:
158
     case PIN_PARTICIPANT:
158
-        return state.map(p => participant(p, action));
159
+        return state.map(p => _participant(p, action));
159
 
160
 
160
     default:
161
     default:
161
         return state;
162
         return state;

+ 3
- 3
react/features/base/redux/MiddlewareRegistry.js Ver fichero

12
         /**
12
         /**
13
          * The set of registered middleware.
13
          * The set of registered middleware.
14
          */
14
          */
15
-        this.middlewareRegistry = new Set();
15
+        this._elements = new Set();
16
     }
16
     }
17
 
17
 
18
     /**
18
     /**
25
      */
25
      */
26
     applyMiddleware(...additional) {
26
     applyMiddleware(...additional) {
27
         return applyMiddleware(
27
         return applyMiddleware(
28
-            ...this.middlewareRegistry,
28
+            ...this._elements,
29
             ...additional
29
             ...additional
30
         );
30
         );
31
     }
31
     }
39
      * @returns {void}
39
      * @returns {void}
40
      */
40
      */
41
     register(middleware) {
41
     register(middleware) {
42
-        this.middlewareRegistry.add(middleware);
42
+        this._elements.add(middleware);
43
     }
43
     }
44
 }
44
 }
45
 
45
 

+ 3
- 3
react/features/base/redux/ReducerRegistry.js Ver fichero

13
          * The set of registered reducers, keyed based on the field each reducer
13
          * The set of registered reducers, keyed based on the field each reducer
14
          * will manage.
14
          * will manage.
15
          */
15
          */
16
-        this.reducerRegistry = {};
16
+        this._elements = {};
17
     }
17
     }
18
 
18
 
19
     /**
19
     /**
25
      */
25
      */
26
     combineReducers(additional = {}) {
26
     combineReducers(additional = {}) {
27
         return combineReducers({
27
         return combineReducers({
28
-            ...this.reducerRegistry,
28
+            ...this._elements,
29
             ...additional
29
             ...additional
30
         });
30
         });
31
     }
31
     }
41
      * @returns {void}
41
      * @returns {void}
42
      */
42
      */
43
     register(name, reducer) {
43
     register(name, reducer) {
44
-        this.reducerRegistry[name] = reducer;
44
+        this._elements[name] = reducer;
45
     }
45
     }
46
 }
46
 }
47
 
47
 

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

53
                     .map(t => t.jitsiTrack)));
53
                     .map(t => t.jitsiTrack)));
54
 }
54
 }
55
 
55
 
56
-/**
57
- * Returns true if the provided JitsiTrack should be rendered as a mirror.
58
- *
59
- * We only want to show a video in mirrored mode when:
60
- * 1) The video source is local, and not remote.
61
- * 2) The video source is a camera, not a desktop (capture).
62
- * 3) The camera is capturing the user, not the environment.
63
- *
64
- * TODO Similar functionality is part of lib-jitsi-meet. This function should be
65
- * removed after https://github.com/jitsi/lib-jitsi-meet/pull/187 is merged.
66
- *
67
- * @param {(JitsiLocalTrack|JitsiRemoteTrack)} track - JitsiTrack instance.
68
- * @private
69
- * @returns {boolean}
70
- */
71
-function _shouldMirror(track) {
72
-    return (
73
-        track
74
-            && track.isLocal()
75
-            && track.isVideoTrack()
76
-
77
-            // XXX Type of the return value of
78
-            // JitsiLocalTrack#getCameraFacingMode() happens to be named
79
-            // CAMERA_FACING_MODE as well, it's defined by lib-jitsi-meet. Note
80
-            // though that the type of the value on the right side of the
81
-            // equality check is defined by jitsi-meet-react. The type
82
-            // definitions are surely compatible today but that may not be the
83
-            // case tomorrow.
84
-            && track.getCameraFacingMode() === CAMERA_FACING_MODE.USER
85
-            && !track.isScreenSharing()
86
-    );
87
-}
88
-
89
 /**
56
 /**
90
  * Create an action for when a new track has been signaled to be added to the
57
  * Create an action for when a new track has been signaled to be added to the
91
  * conference.
58
  * conference.
240
  * through.
207
  * through.
241
  * @param {MEDIA_TYPE} mediaType - The <tt>MEDIA_TYPE</tt> of the first
208
  * @param {MEDIA_TYPE} mediaType - The <tt>MEDIA_TYPE</tt> of the first
242
  * <tt>JitsiLocalTrack</tt> to be returned.
209
  * <tt>JitsiLocalTrack</tt> to be returned.
210
+ * @private
243
  * @returns {JitsiLocalTrack} The first <tt>JitsiLocalTrack</tt>, if any, in the
211
  * @returns {JitsiLocalTrack} The first <tt>JitsiLocalTrack</tt>, if any, in the
244
  * specified <tt>tracks</tt> of the specified <tt>mediaType</tt>.
212
  * specified <tt>tracks</tt> of the specified <tt>mediaType</tt>.
245
  */
213
  */
287
     };
255
     };
288
 }
256
 }
289
 
257
 
258
+/**
259
+ * Returns true if the provided JitsiTrack should be rendered as a mirror.
260
+ *
261
+ * We only want to show a video in mirrored mode when:
262
+ * 1) The video source is local, and not remote.
263
+ * 2) The video source is a camera, not a desktop (capture).
264
+ * 3) The camera is capturing the user, not the environment.
265
+ *
266
+ * TODO Similar functionality is part of lib-jitsi-meet. This function should be
267
+ * removed after https://github.com/jitsi/lib-jitsi-meet/pull/187 is merged.
268
+ *
269
+ * @param {(JitsiLocalTrack|JitsiRemoteTrack)} track - JitsiTrack instance.
270
+ * @private
271
+ * @returns {boolean}
272
+ */
273
+function _shouldMirror(track) {
274
+    return (
275
+        track
276
+            && track.isLocal()
277
+            && track.isVideoTrack()
278
+
279
+            // XXX Type of the return value of
280
+            // JitsiLocalTrack#getCameraFacingMode() happens to be named
281
+            // CAMERA_FACING_MODE as well, it's defined by lib-jitsi-meet. Note
282
+            // though that the type of the value on the right side of the
283
+            // equality check is defined by jitsi-meet-react. The type
284
+            // definitions are surely compatible today but that may not be the
285
+            // case tomorrow.
286
+            && track.getCameraFacingMode() === CAMERA_FACING_MODE.USER
287
+            && !track.isScreenSharing()
288
+    );
289
+}
290
+
290
 /**
291
 /**
291
  * Set new local tracks replacing any existing tracks that were previously
292
  * Set new local tracks replacing any existing tracks that were previously
292
  * available. Currently only one audio and one video local tracks are allowed.
293
  * available. Currently only one audio and one video local tracks are allowed.
293
  *
294
  *
294
  * @param {(JitsiLocalTrack|JitsiRemoteTrack)[]} [newTracks=[]] - List of new
295
  * @param {(JitsiLocalTrack|JitsiRemoteTrack)[]} [newTracks=[]] - List of new
295
  * media tracks.
296
  * media tracks.
297
+ * @private
296
  * @returns {Function}
298
  * @returns {Function}
297
  */
299
  */
298
 function _updateLocalTracks(newTracks = []) {
300
 function _updateLocalTracks(newTracks = []) {

+ 12
- 12
react/features/film-strip/components/Thumbnail.js Ver fichero

45
         this._onClick = this._onClick.bind(this);
45
         this._onClick = this._onClick.bind(this);
46
     }
46
     }
47
 
47
 
48
-    /**
49
-     * Handles click/tap event on the thumbnail.
50
-     *
51
-     * @returns {void}
52
-     */
53
-    _onClick() {
54
-        const { dispatch, participant } = this.props;
55
-
56
-        // TODO The following currently ignores interfaceConfig.filmStripOnly.
57
-        dispatch(pinParticipant(participant.pinned ? null : participant.id));
58
-    }
59
-
60
     /**
48
     /**
61
      * Implements React's {@link Component#render()}.
49
      * Implements React's {@link Component#render()}.
62
      *
50
      *
126
             </Container>
114
             </Container>
127
         );
115
         );
128
     }
116
     }
117
+
118
+    /**
119
+     * Handles click/tap event on the thumbnail.
120
+     *
121
+     * @returns {void}
122
+     */
123
+    _onClick() {
124
+        const { dispatch, participant } = this.props;
125
+
126
+        // TODO The following currently ignores interfaceConfig.filmStripOnly.
127
+        dispatch(pinParticipant(participant.pinned ? null : participant.id));
128
+    }
129
 }
129
 }
130
 
130
 
131
 /**
131
 /**

+ 4
- 3
react/features/wake-lock/middleware.js Ver fichero

22
 
22
 
23
         // TODO(saghul): Implement audio-only mode.
23
         // TODO(saghul): Implement audio-only mode.
24
         if (!state.audioOnly) {
24
         if (!state.audioOnly) {
25
-            setWakeLock(true);
25
+            _setWakeLock(true);
26
         }
26
         }
27
         break;
27
         break;
28
     }
28
     }
29
 
29
 
30
     case CONFERENCE_FAILED:
30
     case CONFERENCE_FAILED:
31
     case CONFERENCE_LEFT:
31
     case CONFERENCE_LEFT:
32
-        setWakeLock(false);
32
+        _setWakeLock(false);
33
         break;
33
         break;
34
     }
34
     }
35
 
35
 
42
  *
42
  *
43
  * @param {boolean} wakeLock - True to active the wake lock or false to
43
  * @param {boolean} wakeLock - True to active the wake lock or false to
44
  * deactivate it.
44
  * deactivate it.
45
+ * @private
45
  * @returns {void}
46
  * @returns {void}
46
  */
47
  */
47
-function setWakeLock(wakeLock) {
48
+function _setWakeLock(wakeLock) {
48
     if (wakeLock) {
49
     if (wakeLock) {
49
         KeepAwake.activate();
50
         KeepAwake.activate();
50
     } else {
51
     } else {

Loading…
Cancelar
Guardar