소스 검색

Coding style

master
Lyubo Marinov 7 년 전
부모
커밋
447035c8b2

+ 1
- 1
react/features/always-on-top/AlwaysOnTop.js 파일 보기

@@ -31,7 +31,7 @@ export default class AlwaysOnTop extends Component<*, State> {
31 31
     _hovered: boolean;
32 32
 
33 33
     /**
34
-     * Initializes new AlwaysOnTop instance.
34
+     * Initializes a new {@code AlwaysOnTop} instance.
35 35
      *
36 36
      * @param {*} props - The read-only properties with which the new instance
37 37
      * is to be initialized.

+ 4
- 3
react/features/always-on-top/AudioMuteButton.js 파일 보기

@@ -112,7 +112,7 @@ export default class AudioMuteButton
112 112
      * Indicates if audio is currently muted ot nor.
113 113
      *
114 114
      * @override
115
-     * @private
115
+     * @protected
116 116
      * @returns {boolean}
117 117
      */
118 118
     _isAudioMuted() {
@@ -123,7 +123,7 @@ export default class AudioMuteButton
123 123
      * Indicates whether this button is disabled or not.
124 124
      *
125 125
      * @override
126
-     * @private
126
+     * @protected
127 127
      * @returns {boolean}
128 128
      */
129 129
     _isDisabled() {
@@ -133,8 +133,9 @@ export default class AudioMuteButton
133 133
     /**
134 134
      * Changes the muted state.
135 135
      *
136
+     * @override
136 137
      * @param {boolean} audioMuted - Whether audio should be muted or not.
137
-     * @private
138
+     * @protected
138 139
      * @returns {void}
139 140
      */
140 141
     _setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars

+ 1
- 1
react/features/always-on-top/HangupButton.js 파일 보기

@@ -13,7 +13,7 @@ export default class HangupButton extends AbstractHangupButton<Props, *> {
13 13
      * Helper function to perform the actual hangup action.
14 14
      *
15 15
      * @override
16
-     * @private
16
+     * @protected
17 17
      * @returns {void}
18 18
      */
19 19
     _doHangup() {

+ 4
- 3
react/features/always-on-top/VideoMuteButton.js 파일 보기

@@ -88,7 +88,7 @@ export default class VideoMuteButton
88 88
      * Indicates whether this button is disabled or not.
89 89
      *
90 90
      * @override
91
-     * @private
91
+     * @protected
92 92
      * @returns {boolean}
93 93
      */
94 94
     _isDisabled() {
@@ -99,7 +99,7 @@ export default class VideoMuteButton
99 99
      * Indicates if video is currently muted ot nor.
100 100
      *
101 101
      * @override
102
-     * @private
102
+     * @protected
103 103
      * @returns {boolean}
104 104
      */
105 105
     _isVideoMuted() {
@@ -109,8 +109,9 @@ export default class VideoMuteButton
109 109
     /**
110 110
      * Changes the muted state.
111 111
      *
112
+     * @override
112 113
      * @param {boolean} videoMuted - Whether video should be muted or not.
113
-     * @private
114
+     * @protected
114 115
      * @returns {void}
115 116
      */
116 117
     _setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars

+ 4
- 5
react/features/base/toolbox/components/AbstractAudioMuteButton.js 파일 보기

@@ -18,7 +18,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
18 18
      * accordingly.
19 19
      *
20 20
      * @override
21
-     * @private
21
+     * @protected
22 22
      * @returns {void}
23 23
      */
24 24
     _handleClick() {
@@ -29,8 +29,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
29 29
      * Helper function to be implemented by subclasses, which must return a
30 30
      * boolean value indicating if audio is muted or not.
31 31
      *
32
-     * @abstract
33
-     * @private
32
+     * @protected
34 33
      * @returns {boolean}
35 34
      */
36 35
     _isAudioMuted() {
@@ -41,7 +40,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
41 40
      * Indicates whether this button is in toggled state or not.
42 41
      *
43 42
      * @override
44
-     * @private
43
+     * @protected
45 44
      * @returns {boolean}
46 45
      */
47 46
     _isToggled() {
@@ -53,7 +52,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
53 52
      * action.
54 53
      *
55 54
      * @param {boolean} audioMuted - Whether video should be muted or not.
56
-     * @private
55
+     * @protected
57 56
      * @returns {void}
58 57
      */
59 58
     _setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars

+ 7
- 8
react/features/base/toolbox/components/AbstractButton.js 파일 보기

@@ -23,8 +23,7 @@ export type Props = {
23 23
     toggledStyles: ?Styles,
24 24
 
25 25
     /**
26
-     * From which direction the tooltip should appear, relative to the
27
-     * button.
26
+     * From which direction the tooltip should appear, relative to the button.
28 27
      */
29 28
     tooltipPosition: string,
30 29
 
@@ -87,11 +86,12 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
87 86
      * Initializes a new {@code AbstractButton} instance.
88 87
      *
89 88
      * @param {Props} props - The React {@code Component} props to initialize
90
-     * the new {@code AbstractAudioMuteButton} instance with.
89
+     * the new {@code AbstractButton} instance with.
91 90
      */
92 91
     constructor(props: P) {
93 92
         super(props);
94 93
 
94
+        // Bind event handlers so they are only bound once per instance.
95 95
         this._onClick = this._onClick.bind(this);
96 96
     }
97 97
 
@@ -99,8 +99,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
99 99
      * Helper function to be implemented by subclasses, which should be used
100 100
      * to handle the button being clicked / pressed.
101 101
      *
102
-     * @abstract
103
-     * @private
102
+     * @protected
104 103
      * @returns {void}
105 104
      */
106 105
     _handleClick() {
@@ -138,7 +137,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
138 137
      * Helper function to be implemented by subclasses, which must return a
139 138
      * boolean value indicating if this button is disabled or not.
140 139
      *
141
-     * @private
140
+     * @protected
142 141
      * @returns {boolean}
143 142
      */
144 143
     _isDisabled() {
@@ -147,9 +146,9 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
147 146
 
148 147
     /**
149 148
      * Helper function to be implemented by subclasses, which must return a
150
-     * boolean value indicating if this button is toggled or not.
149
+     * {@code boolean} value indicating if this button is toggled or not.
151 150
      *
152
-     * @private
151
+     * @protected
153 152
      * @returns {boolean}
154 153
      */
155 154
     _isToggled() {

+ 2
- 3
react/features/base/toolbox/components/AbstractHangupButton.js 파일 보기

@@ -15,7 +15,7 @@ export default class AbstractHangupButton<P : Props, S: *>
15 15
     /**
16 16
      * Handles clicking / pressing the button, and disconnects the conference.
17 17
      *
18
-     * @private
18
+     * @protected
19 19
      * @returns {void}
20 20
      */
21 21
     _handleClick() {
@@ -25,8 +25,7 @@ export default class AbstractHangupButton<P : Props, S: *>
25 25
     /**
26 26
      * Helper function to perform the actual hangup action.
27 27
      *
28
-     * @abstract
29
-     * @private
28
+     * @protected
30 29
      * @returns {void}
31 30
      */
32 31
     _doHangup() {

+ 3
- 11
react/features/base/toolbox/components/AbstractToolboxItem.js 파일 보기

@@ -150,11 +150,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
150 150
     _maybeTranslateAttribute(text) {
151 151
         const { t } = this.props;
152 152
 
153
-        if (typeof t === 'function') {
154
-            return t(text);
155
-        }
156
-
157
-        return text;
153
+        return typeof t === 'function' ? t(text) : text;
158 154
     }
159 155
 
160 156
     _onClick: (*) => void;
@@ -169,7 +165,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
169 165
     _onClick(...args) {
170 166
         const { disabled, onClick } = this.props;
171 167
 
172
-        !disabled && onClick && onClick(...args);
168
+        disabled || (onClick && onClick(...args));
173 169
     }
174 170
 
175 171
     /**
@@ -189,10 +185,6 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
189 185
      * @returns {ReactElement}
190 186
      */
191 187
     render() {
192
-        if (!this.props.visible) {
193
-            return null;
194
-        }
195
-
196
-        return this._renderItem();
188
+        return this.props.visible ? this._renderItem() : null;
197 189
     }
198 190
 }

+ 5
- 6
react/features/base/toolbox/components/AbstractVideoMuteButton.js 파일 보기

@@ -17,7 +17,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
17 17
      * Handles clicking / pressing the button, and toggles the video mute state
18 18
      * accordingly.
19 19
      *
20
-     * @private
20
+     * @protected
21 21
      * @returns {void}
22 22
      */
23 23
     _handleClick() {
@@ -28,7 +28,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
28 28
      * Indicates whether this button is in toggled state or not.
29 29
      *
30 30
      * @override
31
-     * @private
31
+     * @protected
32 32
      * @returns {boolean}
33 33
      */
34 34
     _isToggled() {
@@ -37,10 +37,9 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
37 37
 
38 38
     /**
39 39
      * Helper function to be implemented by subclasses, which must return a
40
-     * boolean value indicating if video is muted or not.
40
+     * {@code boolean} value indicating if video is muted or not.
41 41
      *
42
-     * @abstract
43
-     * @private
42
+     * @protected
44 43
      * @returns {boolean}
45 44
      */
46 45
     _isVideoMuted() {
@@ -52,7 +51,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
52 51
      * action.
53 52
      *
54 53
      * @param {boolean} videoMuted - Whether video should be muted or not.
55
-     * @private
54
+     * @protected
56 55
      * @returns {void}
57 56
      */
58 57
     _setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars

+ 1
- 1
react/features/base/toolbox/components/index.js 파일 보기

@@ -1,7 +1,7 @@
1 1
 // @flow
2 2
 
3
+export { default as AbstractAudioMuteButton } from './AbstractAudioMuteButton';
3 4
 export { default as AbstractButton } from './AbstractButton';
4 5
 export type { Props as AbstractButtonProps } from './AbstractButton';
5
-export { default as AbstractAudioMuteButton } from './AbstractAudioMuteButton';
6 6
 export { default as AbstractHangupButton } from './AbstractHangupButton';
7 7
 export { default as AbstractVideoMuteButton } from './AbstractVideoMuteButton';

+ 1
- 3
react/features/mobile/audio-mode/components/AudioRouteButton.js 파일 보기

@@ -104,12 +104,10 @@ class AudioRouteButton extends AbstractButton<Props, *> {
104 104
      * Implements React's {@link Component#render()}.
105 105
      *
106 106
      * @inheritdoc
107
-     * @returns {?ReactElement}
107
+     * @returns {React$Node}
108 108
      */
109 109
     render() {
110 110
         if (!MPVolumeView && !AudioRoutePickerDialog) {
111
-
112
-            // $FlowFixMe
113 111
             return null;
114 112
         }
115 113
 

+ 3
- 9
react/features/mobile/picture-in-picture/components/PictureInPictureButton.js 파일 보기

@@ -33,7 +33,7 @@ class PictureInPictureButton extends AbstractButton<Props, *> {
33 33
     /**
34 34
      * Handles clicking / pressing the button.
35 35
      *
36
-     * @private
36
+     * @protected
37 37
      * @returns {void}
38 38
      */
39 39
     _handleClick() {
@@ -44,16 +44,10 @@ class PictureInPictureButton extends AbstractButton<Props, *> {
44 44
      * Implements React's {@link Component#render()}.
45 45
      *
46 46
      * @inheritdoc
47
-     * @returns {?ReactElement}
47
+     * @returns {React$Node}
48 48
      */
49 49
     render() {
50
-        if (!this.props._enabled) {
51
-
52
-            // $FlowFixMe
53
-            return null;
54
-        }
55
-
56
-        return super.render();
50
+        return this.props._enabled ? super.render() : null;
57 51
     }
58 52
 }
59 53
 

+ 4
- 3
react/features/room-lock/components/RoomLockButton.js 파일 보기

@@ -38,7 +38,8 @@ class RoomLockButton extends AbstractButton<Props, *> {
38 38
     /**
39 39
      * Handles clicking / pressing the button.
40 40
      *
41
-     * @private
41
+     * @override
42
+     * @protected
42 43
      * @returns {void}
43 44
      */
44 45
     _handleClick() {
@@ -49,7 +50,7 @@ class RoomLockButton extends AbstractButton<Props, *> {
49 50
      * Indicates whether this button is disabled or not.
50 51
      *
51 52
      * @override
52
-     * @private
53
+     * @protected
53 54
      * @returns {boolean}
54 55
      */
55 56
     _isDisabled() {
@@ -60,7 +61,7 @@ class RoomLockButton extends AbstractButton<Props, *> {
60 61
      * Indicates whether this button is in toggled state or not.
61 62
      *
62 63
      * @override
63
-     * @private
64
+     * @protected
64 65
      * @returns {boolean}
65 66
      */
66 67
     _isToggled() {

+ 4
- 1
react/features/settings/components/web/SettingsButton.js 파일 보기

@@ -11,6 +11,9 @@ import { toggleSettings } from '../../../side-panel';
11 11
 
12 12
 declare var interfaceConfig: Object;
13 13
 
14
+/**
15
+ * The type of the React {@code Component} props of {@link SettingsButton}.
16
+ */
14 17
 type Props = AbstractButtonProps & {
15 18
 
16 19
     /**
@@ -41,7 +44,7 @@ class SettingsButton extends AbstractButton<Props, *> {
41 44
     /**
42 45
      * Handles clicking / pressing the button, and opens the appropriate dialog.
43 46
      *
44
-     * @private
47
+     * @protected
45 48
      * @returns {void}
46 49
      */
47 50
     _handleClick() {

+ 5
- 2
react/features/toolbox/components/AudioMuteButton.js 파일 보기

@@ -13,6 +13,9 @@ import { AbstractAudioMuteButton } from '../../base/toolbox';
13 13
 import type { AbstractButtonProps } from '../../base/toolbox';
14 14
 import { isLocalTrackMuted } from '../../base/tracks';
15 15
 
16
+/**
17
+ * The type of the React {@code Component} props of {@link AudioMuteButton}.
18
+ */
16 19
 type Props = AbstractButtonProps & {
17 20
 
18 21
     /**
@@ -39,7 +42,7 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
39 42
      * Indicates if audio is currently muted ot nor.
40 43
      *
41 44
      * @override
42
-     * @private
45
+     * @protected
43 46
      * @returns {boolean}
44 47
      */
45 48
     _isAudioMuted() {
@@ -50,7 +53,7 @@ class AudioMuteButton extends AbstractAudioMuteButton<Props, *> {
50 53
      * Changes the muted state.
51 54
      *
52 55
      * @param {boolean} audioMuted - Whether audio should be muted or not.
53
-     * @private
56
+     * @protected
54 57
      * @returns {void}
55 58
      */
56 59
     _setAudioMuted(audioMuted: boolean) {

+ 5
- 3
react/features/toolbox/components/HangupButton.js 파일 보기

@@ -4,19 +4,21 @@ import { connect } from 'react-redux';
4 4
 
5 5
 import { createToolbarEvent, sendAnalytics } from '../../analytics';
6 6
 import { appNavigate } from '../../app';
7
-
8 7
 import { disconnect } from '../../base/connection';
9 8
 import { translate } from '../../base/i18n';
10 9
 import { AbstractHangupButton } from '../../base/toolbox';
11 10
 import type { AbstractButtonProps } from '../../base/toolbox';
12 11
 
12
+/**
13
+ * The type of the React {@code Component} props of {@link HangupButton}.
14
+ */
13 15
 type Props = AbstractButtonProps & {
14 16
 
15 17
     /**
16 18
      * The redux {@code dispatch} function.
17 19
      */
18 20
     dispatch: Function
19
-}
21
+};
20 22
 
21 23
 /**
22 24
  * Component that renders a toolbar button for leaving the current conference.
@@ -31,7 +33,7 @@ class HangupButton extends AbstractHangupButton<Props, *> {
31 33
      * Helper function to perform the actual hangup action.
32 34
      *
33 35
      * @override
34
-     * @private
36
+     * @protected
35 37
      * @returns {void}
36 38
      */
37 39
     _doHangup() {

+ 7
- 3
react/features/toolbox/components/VideoMuteButton.js 파일 보기

@@ -17,6 +17,9 @@ import { AbstractVideoMuteButton } from '../../base/toolbox';
17 17
 import type { AbstractButtonProps } from '../../base/toolbox';
18 18
 import { isLocalTrackMuted } from '../../base/tracks';
19 19
 
20
+/**
21
+ * The type of the React {@code Component} props of {@link VideoMuteButton}.
22
+ */
20 23
 type Props = AbstractButtonProps & {
21 24
 
22 25
     /**
@@ -48,7 +51,7 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
48 51
      * Indicates if this button should be disabled or not.
49 52
      *
50 53
      * @override
51
-     * @private
54
+     * @protected
52 55
      * @returns {boolean}
53 56
      */
54 57
     _isDisabled() {
@@ -59,7 +62,7 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
59 62
      * Indicates if video is currently muted ot nor.
60 63
      *
61 64
      * @override
62
-     * @private
65
+     * @protected
63 66
      * @returns {boolean}
64 67
      */
65 68
     _isVideoMuted() {
@@ -69,8 +72,9 @@ class VideoMuteButton extends AbstractVideoMuteButton<Props, *> {
69 72
     /**
70 73
      * Changes the muted state.
71 74
      *
75
+     * @override
72 76
      * @param {boolean} videoMuted - Whether video should be muted or not.
73
-     * @private
77
+     * @protected
74 78
      * @returns {void}
75 79
      */
76 80
     _setVideoMuted(videoMuted: boolean) {

+ 6
- 2
react/features/toolbox/components/native/AudioOnlyButton.js 파일 보기

@@ -7,6 +7,9 @@ import { translate } from '../../../base/i18n';
7 7
 import { AbstractButton } from '../../../base/toolbox';
8 8
 import type { AbstractButtonProps } from '../../../base/toolbox';
9 9
 
10
+/**
11
+ * The type of the React {@code Component} props of {@link AudioOnlyButton}.
12
+ */
10 13
 type Props = AbstractButtonProps & {
11 14
 
12 15
     /**
@@ -32,7 +35,8 @@ class AudioOnlyButton extends AbstractButton<Props, *> {
32 35
     /**
33 36
      * Handles clicking / pressing the button.
34 37
      *
35
-     * @private
38
+     * @override
39
+     * @protected
36 40
      * @returns {void}
37 41
      */
38 42
     _handleClick() {
@@ -43,7 +47,7 @@ class AudioOnlyButton extends AbstractButton<Props, *> {
43 47
      * Indicates whether this button is in toggled state or not.
44 48
      *
45 49
      * @override
46
-     * @private
50
+     * @protected
47 51
      * @returns {boolean}
48 52
      */
49 53
     _isToggled() {

+ 6
- 2
react/features/toolbox/components/native/ToggleCameraButton.js 파일 보기

@@ -8,6 +8,9 @@ import { AbstractButton } from '../../../base/toolbox';
8 8
 import type { AbstractButtonProps } from '../../../base/toolbox';
9 9
 import { isLocalTrackMuted } from '../../../base/tracks';
10 10
 
11
+/**
12
+ * The type of the React {@code Component} props of {@link ToggleCameraButton}.
13
+ */
11 14
 type Props = AbstractButtonProps & {
12 15
 
13 16
     /**
@@ -37,7 +40,8 @@ class ToggleCameraButton extends AbstractButton<Props, *> {
37 40
     /**
38 41
      * Handles clicking / pressing the button.
39 42
      *
40
-     * @private
43
+     * @override
44
+     * @protected
41 45
      * @returns {void}
42 46
      */
43 47
     _handleClick() {
@@ -48,7 +52,7 @@ class ToggleCameraButton extends AbstractButton<Props, *> {
48 52
      * Indicates whether this button is disabled or not.
49 53
      *
50 54
      * @override
51
-     * @private
55
+     * @protected
52 56
      * @returns {boolean}
53 57
      */
54 58
     _isDisabled() {

+ 1
- 1
react/features/toolbox/components/native/Toolbox.js 파일 보기

@@ -169,7 +169,7 @@ class Toolbox extends Component<Props> {
169 169
  *
170 170
  * @param {Object} state - The redux state of which parts are to be mapped to
171 171
  * {@code Toolbox} props.
172
- * @protected
172
+ * @private
173 173
  * @returns {{
174 174
  *     _enabled: boolean,
175 175
  *     _visible: boolean

+ 4
- 1
react/features/toolbox/components/web/Toolbox.js 파일 보기

@@ -50,6 +50,9 @@ import OverflowMenuProfileItem from './OverflowMenuProfileItem';
50 50
 import ToolbarButton from './ToolbarButton';
51 51
 import VideoMuteButton from '../VideoMuteButton';
52 52
 
53
+/**
54
+ * The type of the React {@code Component} props of {@link Toolbox}.
55
+ */
53 56
 type Props = {
54 57
 
55 58
     /**
@@ -169,7 +172,7 @@ type Props = {
169 172
      * Invoked to obtain translated strings.
170 173
      */
171 174
     t: Function
172
-}
175
+};
173 176
 
174 177
 declare var APP: Object;
175 178
 declare var interfaceConfig: Object;

Loading…
취소
저장