Преглед изворни кода

Coding style: consistency, jsdocs

These modification are not necessarily directly related to the
containing PR, I merely saw them while reviewing the containing PR.
j8
Lyubo Marinov пре 7 година
родитељ
комит
d1e5e6b93b

+ 22
- 22
react/features/base/jwt/components/CallOverlay.js Прегледај датотеку

@@ -1,4 +1,4 @@
1
-/* @flow */
1
+// @flow
2 2
 
3 3
 import PropTypes from 'prop-types';
4 4
 import React, { Component } from 'react';
@@ -22,6 +22,27 @@ declare var interfaceConfig: Object;
22 22
  * @extends Component
23 23
  */
24 24
 class CallOverlay extends Component<*, *> {
25
+    /**
26
+     * {@code CallOverlay} component's property types.
27
+     *
28
+     * @static
29
+     */
30
+    static propTypes = {
31
+        _callee: PropTypes.object
32
+    };
33
+
34
+    /**
35
+     * Determines whether this overlay needs to be rendered (according to a
36
+     * specific redux state). Called by {@link OverlayContainer}.
37
+     *
38
+     * @param {Object} state - The redux state.
39
+     * @returns {boolean} - If this overlay needs to be rendered, {@code true};
40
+     * {@code false}, otherwise.
41
+     */
42
+    static needsRender(state) {
43
+        return state['features/base/jwt'].callOverlayVisible;
44
+    }
45
+
25 46
     /**
26 47
      * The (reference to the) {@link Audio} which plays/renders the audio
27 48
      * depicting the ringing phase of the call establishment represented by this
@@ -68,27 +89,6 @@ class CallOverlay extends Component<*, *> {
68 89
         ringing: boolean
69 90
     }
70 91
 
71
-    /**
72
-     * {@code CallOverlay} component's property types.
73
-     *
74
-     * @static
75
-     */
76
-    static propTypes = {
77
-        _callee: PropTypes.object
78
-    };
79
-
80
-    /**
81
-     * Check if this overlay needs to be rendered. This function will be called
82
-     * by the {@code OverlayContainer}.
83
-     *
84
-     * @param {Object} state - The redux state.
85
-     * @returns {boolean} - True if this overlay needs to be rendered, false
86
-     * otherwise.
87
-     */
88
-    static needsRender(state) {
89
-        return state['features/base/jwt'].callOverlayVisible;
90
-    }
91
-
92 92
     /**
93 93
      * Initializes a new {@code CallOverlay} instance.
94 94
      *

+ 18
- 16
react/features/base/lib-jitsi-meet/functions.js Прегледај датотеку

@@ -1,8 +1,8 @@
1
-/* @flow */
1
+// @flow
2 2
 
3
-import { setConfigFromURLParams } from '../../base/config';
4
-import { toState } from '../../base/redux';
5
-import { loadScript } from '../../base/util';
3
+import { setConfigFromURLParams } from '../config';
4
+import { toState } from '../redux';
5
+import { loadScript } from '../util';
6 6
 
7 7
 import JitsiMeetJS from './_';
8 8
 
@@ -54,17 +54,18 @@ export function isAnalyticsEnabled(stateful: Function | Object) {
54 54
 }
55 55
 
56 56
 /**
57
- * Determines whether a specific JitsiConferenceErrors instance indicates a
58
- * fatal JitsiConference error.
57
+ * Determines whether a specific {@link JitsiConferenceErrors} instance
58
+ * indicates a fatal {@link JitsiConference} error.
59 59
  *
60 60
  * FIXME Figure out the category of errors defined by the function and describe
61 61
  * that category. I've currently named the category fatal because it appears to
62 62
  * be used in the cases of unrecoverable errors that necessitate a reload.
63 63
  *
64
- * @param {Object|string} error - The JitsiConferenceErrors instance to
65
- * categorize/classify or an Error-like object.
66
- * @returns {boolean} True if the specified JitsiConferenceErrors instance
67
- * indicates a fatal JitsiConference error; otherwise, false.
64
+ * @param {Object|string} error - The {@code JitsiConferenceErrors} instance to
65
+ * categorize/classify or an {@link Error}-like object.
66
+ * @returns {boolean} If the specified {@code JitsiConferenceErrors} instance
67
+ * indicates a fatal {@code JitsiConference} error, {@code true}; otherwise,
68
+ * {@code false}.
68 69
  */
69 70
 export function isFatalJitsiConferenceError(error: Object | string) {
70 71
     if (typeof error !== 'string') {
@@ -78,17 +79,18 @@ export function isFatalJitsiConferenceError(error: Object | string) {
78 79
 }
79 80
 
80 81
 /**
81
- * Determines whether a specific JitsiConnectionErrors instance indicates a
82
- * fatal JitsiConnection error.
82
+ * Determines whether a specific {@link JitsiConnectionErrors} instance
83
+ * indicates a fatal {@link JitsiConnection} error.
83 84
  *
84 85
  * FIXME Figure out the category of errors defined by the function and describe
85 86
  * that category. I've currently named the category fatal because it appears to
86 87
  * be used in the cases of unrecoverable errors that necessitate a reload.
87 88
  *
88
- * @param {Object|string} error - The JitsiConnectionErrors instance to
89
- * categorize/classify or an Error-like object.
90
- * @returns {boolean} True if the specified JitsiConnectionErrors instance
91
- * indicates a fatal JitsiConnection error; otherwise, false.
89
+ * @param {Object|string} error - The {@code JitsiConnectionErrors} instance to
90
+ * categorize/classify or an {@link Error}-like object.
91
+ * @returns {boolean} If the specified {@code JitsiConnectionErrors} instance
92
+ * indicates a fatal {@code JitsiConnection} error, {@code true}; otherwise,
93
+ * {@code false}.
92 94
  */
93 95
 export function isFatalJitsiConnectionError(error: Object | string) {
94 96
     if (typeof error !== 'string') {

+ 29
- 31
react/features/overlay/components/AbstractPageReloadOverlay.js Прегледај датотеку

@@ -1,4 +1,4 @@
1
-/* @flow */
1
+// @flow
2 2
 
3 3
 import PropTypes from 'prop-types';
4 4
 import React, { Component } from 'react';
@@ -17,11 +17,11 @@ declare var APP: Object;
17 17
 const logger = require('jitsi-meet-logger').getLogger(__filename);
18 18
 
19 19
 /**
20
- * Implements abstract React Component for the page reload overlays.
20
+ * Implements an abstract React {@link Component} for the page reload overlays.
21 21
  */
22 22
 export default class AbstractPageReloadOverlay extends Component<*, *> {
23 23
     /**
24
-     * AbstractPageReloadOverlay component's property types.
24
+     * {@code AbstractPageReloadOverlay} component's property types.
25 25
      *
26 26
      * @static
27 27
      */
@@ -55,6 +55,25 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
55 55
         t: PropTypes.func
56 56
     };
57 57
 
58
+    /**
59
+     * Determines whether this overlay needs to be rendered (according to a
60
+     * specific redux state). Called by {@link OverlayContainer}.
61
+     *
62
+     * @param {Object} state - The redux state.
63
+     * @returns {boolean} - If this overlay needs to be rendered, {@code true};
64
+     * {@code false}, otherwise.
65
+     */
66
+    static needsRender(state) {
67
+        const conferenceError = state['features/base/conference'].error;
68
+        const connectionError = state['features/base/connection'].error;
69
+
70
+        return (
71
+            (connectionError && isFatalJitsiConnectionError(connectionError))
72
+                || (conferenceError
73
+                    && isFatalJitsiConferenceError(conferenceError))
74
+        );
75
+    }
76
+
58 77
     _interval: ?number
59 78
 
60 79
     state: {
@@ -89,25 +108,6 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
89 108
         title: string
90 109
     }
91 110
 
92
-    /**
93
-     * Check if this overlay needs to be rendered. This function will be called
94
-     * by the {@code OverlayContainer}.
95
-     *
96
-     * @param {Object} state - The redux state.
97
-     * @returns {boolean} - True if this overlay needs to be rendered, false
98
-     * otherwise.
99
-     */
100
-    static needsRender(state) {
101
-        const conferenceError = state['features/base/conference'].error;
102
-        const connectionError = state['features/base/connection'].error;
103
-
104
-        return (
105
-            (connectionError && isFatalJitsiConnectionError(connectionError))
106
-                || (conferenceError
107
-                    && isFatalJitsiConferenceError(conferenceError))
108
-        );
109
-    }
110
-
111 111
     /**
112 112
      * Initializes a new AbstractPageReloadOverlay instance.
113 113
      *
@@ -220,10 +220,10 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
220 220
      * @returns {ReactElement}
221 221
      */
222 222
     _renderProgressBar() {
223
-        const { timeoutSeconds, timeLeft } = this.state;
223
+        const { timeLeft, timeoutSeconds } = this.state;
224 224
         const timeRemaining = timeoutSeconds - timeLeft;
225
-        const percentageComplete = Math.floor(
226
-            (timeRemaining / timeoutSeconds) * 100);
225
+        const percentageComplete
226
+            = Math.floor((timeRemaining / timeoutSeconds) * 100);
227 227
 
228 228
         return (
229 229
             <div
@@ -231,9 +231,7 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
231 231
                 id = 'reloadProgressBar'>
232 232
                 <div
233 233
                     className = 'progress-indicator-fill'
234
-                    style = {{
235
-                        width: `${percentageComplete}%`
236
-                    }} />
234
+                    style = {{ width: `${percentageComplete}%` }} />
237 235
             </div>
238 236
         );
239 237
     }
@@ -243,11 +241,11 @@ export default class AbstractPageReloadOverlay extends Component<*, *> {
243 241
  * Maps (parts of) the redux state to the associated component's props.
244 242
  *
245 243
  * @param {Object} state - The redux state.
244
+ * @protected
246 245
  * @returns {{
247
- *      isNetworkFailure: boolean,
248
- *      reason: string
246
+ *     isNetworkFailure: boolean,
247
+ *     reason: string
249 248
  * }}
250
- * @protected
251 249
  */
252 250
 export function abstractMapStateToProps(state: Object) {
253 251
     const conferenceError = state['features/base/conference'].error;

+ 7
- 17
react/features/overlay/components/AbstractSuspendedOverlay.js Прегледај датотеку

@@ -2,12 +2,12 @@ import PropTypes from 'prop-types';
2 2
 import { Component } from 'react';
3 3
 
4 4
 /**
5
- * Implements a React Component for suspended overlay. Shown when a suspend is
6
- * detected.
5
+ * Implements a React {@link Component} for suspended overlay. Shown when a
6
+ * suspend is detected.
7 7
  */
8 8
 export default class AbstractSuspendedOverlay extends Component {
9 9
     /**
10
-     * SuspendedOverlay component's property types.
10
+     * {@code AbstractSuspendedOverlay} component's property types.
11 11
      *
12 12
      * @static
13 13
      */
@@ -22,24 +22,14 @@ export default class AbstractSuspendedOverlay extends Component {
22 22
     };
23 23
 
24 24
     /**
25
-     * Check if this overlay needs to be rendered. This function will be called
26
-     * by the {@code OverlayContainer}.
25
+     * Determines whether this overlay needs to be rendered (according to a
26
+     * specific redux state). Called by {@link OverlayContainer}.
27 27
      *
28 28
      * @param {Object} state - The redux state.
29
-     * @returns {boolean} - True if this overlay needs to be rendered, false
30
-     * otherwise.
29
+     * @returns {boolean} - If this overlay needs to be rendered, {@code true};
30
+     * {@code false}, otherwise.
31 31
      */
32 32
     static needsRender(state) {
33 33
         return state['features/overlay'].suspendDetected;
34 34
     }
35
-
36
-    /**
37
-     * Implements React's {@link Component#render()}.
38
-     *
39
-     * @inheritdoc
40
-     * @returns {ReactElement|null}
41
-     */
42
-    render() {
43
-        return null;
44
-    }
45 35
 }

+ 9
- 20
react/features/overlay/components/AbstractUserMediaPermissionsOverlay.js Прегледај датотеку

@@ -1,14 +1,13 @@
1 1
 import PropTypes from 'prop-types';
2 2
 import { Component } from 'react';
3 3
 
4
-
5 4
 /**
6
- * Implements a React Component for overlay with guidance how to proceed with
7
- * gUM prompt.
5
+ * Implements a React {@link Component} for overlay with guidance how to proceed
6
+ * with gUM prompt.
8 7
  */
9 8
 export default class AbstractUserMediaPermissionsOverlay extends Component {
10 9
     /**
11
-     * UserMediaPermissionsOverlay component's property types.
10
+     * {@code AbstractUserMediaPermissionsOverlay} component's property types.
12 11
      *
13 12
      * @static
14 13
      */
@@ -32,36 +31,26 @@ export default class AbstractUserMediaPermissionsOverlay extends Component {
32 31
     };
33 32
 
34 33
     /**
35
-     * Check if this overlay needs to be rendered. This function will be called
36
-     * by the {@code OverlayContainer}.
34
+     * Determines whether this overlay needs to be rendered (according to a
35
+     * specific redux state). Called by {@link OverlayContainer}.
37 36
      *
38 37
      * @param {Object} state - The redux state.
39
-     * @returns {boolean} - True if this overlay needs to be rendered, false
40
-     * otherwise.
38
+     * @returns {boolean} - If this overlay needs to be rendered, {@code true};
39
+     * {@code false}, otherwise.
41 40
      */
42 41
     static needsRender(state) {
43 42
         return state['features/overlay'].isMediaPermissionPromptVisible;
44 43
     }
45
-
46
-    /**
47
-     * Implements React's {@link Component#render()}.
48
-     *
49
-     * @inheritdoc
50
-     * @returns {ReactElement|null}
51
-     */
52
-    render() {
53
-        return null;
54
-    }
55 44
 }
56 45
 
57 46
 /**
58 47
  * Maps (parts of) the redux state to the associated component's props.
59 48
  *
60 49
  * @param {Object} state - The redux state.
50
+ * @protected
61 51
  * @returns {{
62
- *      browser: string
52
+ *     browser: string
63 53
  * }}
64
- * @protected
65 54
  */
66 55
 export function abstractMapStateToProps(state) {
67 56
     const { browser } = state['features/overlay'];

+ 1
- 1
react/features/overlay/components/FilmstripOnlyOverlayFrame.js Прегледај датотеку

@@ -82,7 +82,7 @@ class FilmstripOnlyOverlayFrame extends Component {
82 82
      * Implements React's {@link Component#render()}.
83 83
      *
84 84
      * @inheritdoc
85
-     * @returns {ReactElement|null}
85
+     * @returns {ReactElement}
86 86
      */
87 87
     render() {
88 88
         return (

+ 7
- 6
react/features/overlay/components/OverlayContainer.js Прегледај датотеку

@@ -51,8 +51,8 @@ function getOverlays() {
51 51
 }
52 52
 
53 53
 /**
54
- * Implements a React Component that will display the correct overlay when
55
- * needed.
54
+ * Implements a React {@link Component} that will display the correct overlay
55
+ * when needed.
56 56
  */
57 57
 class OverlayContainer extends Component {
58 58
     /**
@@ -71,8 +71,8 @@ class OverlayContainer extends Component {
71 71
      * Implements React's {@link Component#render()}.
72 72
      *
73 73
      * @inheritdoc
74
-     * @returns {ReactElement|null}
75 74
      * @public
75
+     * @returns {ReactElement|null}
76 76
      */
77 77
     render() {
78 78
         const { overlay } = this.props;
@@ -82,13 +82,14 @@ class OverlayContainer extends Component {
82 82
 }
83 83
 
84 84
 /**
85
- * Maps (parts of) the redux state to the associated OverlayContainer's props.
85
+ * Maps (parts of) the redux state to the associated {@code OverlayContainer}'s
86
+ * props.
86 87
  *
87 88
  * @param {Object} state - The redux state.
89
+ * @private
88 90
  * @returns {{
89
- *      overlay: ?Object
91
+ *     overlay: ?Object
90 92
  * }}
91
- * @private
92 93
  */
93 94
 function _mapStateToProps(state) {
94 95
     let overlay;

+ 1
- 1
react/features/overlay/components/OverlayFrame.js Прегледај датотеку

@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
4 4
 import React, { Component } from 'react';
5 5
 
6 6
 /**
7
- * Implements a React Component for the frame of the overlays.
7
+ * Implements a React {@link Component} for the frame of the overlays.
8 8
  */
9 9
 export default class OverlayFrame extends Component {
10 10
     /**

+ 1
- 2
react/features/overlay/components/SuspendedFilmstripOnlyOverlay.js Прегледај датотеку

@@ -15,8 +15,7 @@ class SuspendedFilmstripOnlyOverlay extends AbstractSuspendedOverlay {
15 15
      * Implements React's {@link Component#render()}.
16 16
      *
17 17
      * @inheritdoc
18
-     * @override
19
-     * @returns {ReactElement|null}
18
+     * @returns {ReactElement}
20 19
      */
21 20
     render() {
22 21
         const { t } = this.props;

+ 1
- 2
react/features/overlay/components/SuspendedOverlay.js Прегледај датотеку

@@ -15,8 +15,7 @@ class SuspendedOverlay extends AbstractSuspendedOverlay {
15 15
      * Implements React's {@link Component#render()}.
16 16
      *
17 17
      * @inheritdoc
18
-     * @override
19
-     * @returns {ReactElement|null}
18
+     * @returns {ReactElement}
20 19
      */
21 20
     render() {
22 21
         const { t } = this.props;

+ 2
- 2
react/features/overlay/components/UserMediaPermissionsFilmstripOnlyOverlay.js Прегледај датотеку

@@ -13,12 +13,12 @@ import FilmstripOnlyOverlayFrame from './FilmstripOnlyOverlayFrame';
13 13
  */
14 14
 class UserMediaPermissionsFilmstripOnlyOverlay
15 15
     extends AbstractUserMediaPermissionsOverlay {
16
+
16 17
     /**
17 18
      * Implements React's {@link Component#render()}.
18 19
      *
19 20
      * @inheritdoc
20
-     * @override
21
-     * @returns {ReactElement|null}
21
+     * @returns {ReactElement}
22 22
      */
23 23
     render() {
24 24
         const { t } = this.props;

+ 2
- 3
react/features/overlay/components/UserMediaPermissionsOverlay.js Прегледај датотеку

@@ -38,8 +38,7 @@ class UserMediaPermissionsOverlay extends AbstractUserMediaPermissionsOverlay {
38 38
      * Implements React's {@link Component#render()}.
39 39
      *
40 40
      * @inheritdoc
41
-     * @override
42
-     * @returns {ReactElement|null}
41
+     * @returns {ReactElement}
43 42
      */
44 43
     render() {
45 44
         const { browser, t } = this.props;
@@ -77,8 +76,8 @@ class UserMediaPermissionsOverlay extends AbstractUserMediaPermissionsOverlay {
77 76
     /**
78 77
      * Renders the policy logo.
79 78
      *
80
-     * @returns {ReactElement|null}
81 79
      * @private
80
+     * @returns {ReactElement|null}
82 81
      */
83 82
     _renderPolicyLogo() {
84 83
         const { policyLogoSrc } = this.state;

Loading…
Откажи
Сачувај