Selaa lähdekoodia

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 8 vuotta sitten
vanhempi
commit
349c04d8d1

+ 8
- 8
react/features/audio-mode/middleware.js Näytä tiedosto

@@ -22,19 +22,19 @@ MiddlewareRegistry.register(store => next => action => {
22 22
     // The react-native module AudioMode is implemented on iOS at the time of
23 23
     // this writing.
24 24
     if (AudioMode) {
25
-        let audioMode;
25
+        let mode;
26 26
 
27 27
         switch (action.type) {
28 28
         case APP_WILL_MOUNT:
29 29
         case CONFERENCE_FAILED:
30 30
         case CONFERENCE_LEFT:
31
-            audioMode = AudioMode.DEFAULT;
31
+            mode = AudioMode.DEFAULT;
32 32
             break;
33 33
 
34 34
         case CONFERENCE_WILL_JOIN: {
35 35
             const conference = store.getState()['features/base/conference'];
36 36
 
37
-            audioMode
37
+            mode
38 38
                 = conference.audioOnly
39 39
                     ? AudioMode.AUDIO_CALL
40 40
                     : AudioMode.VIDEO_CALL;
@@ -42,14 +42,14 @@ MiddlewareRegistry.register(store => next => action => {
42 42
         }
43 43
 
44 44
         default:
45
-            audioMode = null;
45
+            mode = null;
46 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 Näytä tiedosto

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

+ 3
- 2
react/features/base/media/components/native/VideoTrack.js Näytä tiedosto

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

+ 6
- 4
react/features/base/media/middleware.js Näytä tiedosto

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

+ 6
- 4
react/features/base/media/reducer.js Näytä tiedosto

@@ -31,9 +31,10 @@ const AUDIO_INITIAL_MEDIA_STATE = {
31 31
  * @param {AudioMediaState} state - Media state of local audio.
32 32
  * @param {Object} action - Action object.
33 33
  * @param {string} action.type - Type of action.
34
+ * @private
34 35
  * @returns {AudioMediaState}
35 36
  */
36
-function audio(state = AUDIO_INITIAL_MEDIA_STATE, action) {
37
+function _audio(state = AUDIO_INITIAL_MEDIA_STATE, action) {
37 38
     switch (action.type) {
38 39
     case SET_AUDIO_MUTED:
39 40
         return {
@@ -70,9 +71,10 @@ const VIDEO_INITIAL_MEDIA_STATE = {
70 71
  * @param {VideoMediaState} state - Media state of local video.
71 72
  * @param {Object} action - Action object.
72 73
  * @param {string} action.type - Type of action.
74
+ * @private
73 75
  * @returns {VideoMediaState}
74 76
  */
75
-function video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
77
+function _video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
76 78
     switch (action.type) {
77 79
     case SET_CAMERA_FACING_MODE:
78 80
         return {
@@ -102,6 +104,6 @@ function video(state = VIDEO_INITIAL_MEDIA_STATE, action) {
102 104
  * @returns {Object}
103 105
  */
104 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 Näytä tiedosto

@@ -20,7 +20,7 @@ class RouteRegistry {
20 20
          *
21 21
          * @private
22 22
          */
23
-        this._routeRegistry = new Set();
23
+        this._elements = new Set();
24 24
     }
25 25
 
26 26
     /**
@@ -57,7 +57,7 @@ class RouteRegistry {
57 57
         // We use the destructuring operator to 'clone' the route object to
58 58
         // prevent modifications from outside (e.g. React Native's Navigator
59 59
         // extends it with additional properties).
60
-        return [ ...this._routeRegistry ].map(r => {
60
+        return [ ...this._elements ].map(r => {
61 61
             return { ...r };
62 62
         });
63 63
     }
@@ -71,7 +71,7 @@ class RouteRegistry {
71 71
      */
72 72
     getRouteByComponent(component) {
73 73
         const route
74
-            = [ ...this._routeRegistry ].find(r => r.component === component);
74
+            = [ ...this._elements ].find(r => r.component === component);
75 75
 
76 76
         // We use destructuring operator to 'clone' route object to prevent
77 77
         // modifications from outside (e.g. React Native's Navigator extends
@@ -86,11 +86,11 @@ class RouteRegistry {
86 86
      * @returns {void}
87 87
      */
88 88
     register(route) {
89
-        if (this._routeRegistry.has(route)) {
89
+        if (this._elements.has(route)) {
90 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 Näytä tiedosto

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

+ 3
- 3
react/features/base/redux/MiddlewareRegistry.js Näytä tiedosto

@@ -12,7 +12,7 @@ class MiddlewareRegistry {
12 12
         /**
13 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,7 +25,7 @@ class MiddlewareRegistry {
25 25
      */
26 26
     applyMiddleware(...additional) {
27 27
         return applyMiddleware(
28
-            ...this.middlewareRegistry,
28
+            ...this._elements,
29 29
             ...additional
30 30
         );
31 31
     }
@@ -39,7 +39,7 @@ class MiddlewareRegistry {
39 39
      * @returns {void}
40 40
      */
41 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 Näytä tiedosto

@@ -13,7 +13,7 @@ class ReducerRegistry {
13 13
          * The set of registered reducers, keyed based on the field each reducer
14 14
          * will manage.
15 15
          */
16
-        this.reducerRegistry = {};
16
+        this._elements = {};
17 17
     }
18 18
 
19 19
     /**
@@ -25,7 +25,7 @@ class ReducerRegistry {
25 25
      */
26 26
     combineReducers(additional = {}) {
27 27
         return combineReducers({
28
-            ...this.reducerRegistry,
28
+            ...this._elements,
29 29
             ...additional
30 30
         });
31 31
     }
@@ -41,7 +41,7 @@ class ReducerRegistry {
41 41
      * @returns {void}
42 42
      */
43 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 Näytä tiedosto

@@ -53,39 +53,6 @@ export function destroyLocalTracks() {
53 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 57
  * Create an action for when a new track has been signaled to be added to the
91 58
  * conference.
@@ -240,6 +207,7 @@ function _disposeAndRemoveTracks(tracks) {
240 207
  * through.
241 208
  * @param {MEDIA_TYPE} mediaType - The <tt>MEDIA_TYPE</tt> of the first
242 209
  * <tt>JitsiLocalTrack</tt> to be returned.
210
+ * @private
243 211
  * @returns {JitsiLocalTrack} The first <tt>JitsiLocalTrack</tt>, if any, in the
244 212
  * specified <tt>tracks</tt> of the specified <tt>mediaType</tt>.
245 213
  */
@@ -287,12 +255,46 @@ function _getLocalTracksToChange(currentTracks, newTracks) {
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 292
  * Set new local tracks replacing any existing tracks that were previously
292 293
  * available. Currently only one audio and one video local tracks are allowed.
293 294
  *
294 295
  * @param {(JitsiLocalTrack|JitsiRemoteTrack)[]} [newTracks=[]] - List of new
295 296
  * media tracks.
297
+ * @private
296 298
  * @returns {Function}
297 299
  */
298 300
 function _updateLocalTracks(newTracks = []) {

+ 12
- 12
react/features/film-strip/components/Thumbnail.js Näytä tiedosto

@@ -45,18 +45,6 @@ class Thumbnail extends Component {
45 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 49
      * Implements React's {@link Component#render()}.
62 50
      *
@@ -126,6 +114,18 @@ class Thumbnail extends Component {
126 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 Näytä tiedosto

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

Loading…
Peruuta
Tallenna