Coding style

This commit is contained in:
Lyubo Marinov
2018-05-10 21:10:26 -05:00
parent 7fe421aeba
commit 447035c8b2
21 changed files with 78 additions and 72 deletions

View File

@@ -18,7 +18,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
* accordingly.
*
* @override
* @private
* @protected
* @returns {void}
*/
_handleClick() {
@@ -29,8 +29,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
* Helper function to be implemented by subclasses, which must return a
* boolean value indicating if audio is muted or not.
*
* @abstract
* @private
* @protected
* @returns {boolean}
*/
_isAudioMuted() {
@@ -41,7 +40,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
* Indicates whether this button is in toggled state or not.
*
* @override
* @private
* @protected
* @returns {boolean}
*/
_isToggled() {
@@ -53,7 +52,7 @@ export default class AbstractAudioMuteButton<P: Props, S: *>
* action.
*
* @param {boolean} audioMuted - Whether video should be muted or not.
* @private
* @protected
* @returns {void}
*/
_setAudioMuted(audioMuted: boolean) { // eslint-disable-line no-unused-vars

View File

@@ -23,8 +23,7 @@ export type Props = {
toggledStyles: ?Styles,
/**
* From which direction the tooltip should appear, relative to the
* button.
* From which direction the tooltip should appear, relative to the button.
*/
tooltipPosition: string,
@@ -87,11 +86,12 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
* Initializes a new {@code AbstractButton} instance.
*
* @param {Props} props - The React {@code Component} props to initialize
* the new {@code AbstractAudioMuteButton} instance with.
* the new {@code AbstractButton} instance with.
*/
constructor(props: P) {
super(props);
// Bind event handlers so they are only bound once per instance.
this._onClick = this._onClick.bind(this);
}
@@ -99,8 +99,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
* Helper function to be implemented by subclasses, which should be used
* to handle the button being clicked / pressed.
*
* @abstract
* @private
* @protected
* @returns {void}
*/
_handleClick() {
@@ -138,7 +137,7 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
* Helper function to be implemented by subclasses, which must return a
* boolean value indicating if this button is disabled or not.
*
* @private
* @protected
* @returns {boolean}
*/
_isDisabled() {
@@ -147,9 +146,9 @@ export default class AbstractButton<P: Props, S: *> extends Component<P, S> {
/**
* Helper function to be implemented by subclasses, which must return a
* boolean value indicating if this button is toggled or not.
* {@code boolean} value indicating if this button is toggled or not.
*
* @private
* @protected
* @returns {boolean}
*/
_isToggled() {

View File

@@ -15,7 +15,7 @@ export default class AbstractHangupButton<P : Props, S: *>
/**
* Handles clicking / pressing the button, and disconnects the conference.
*
* @private
* @protected
* @returns {void}
*/
_handleClick() {
@@ -25,8 +25,7 @@ export default class AbstractHangupButton<P : Props, S: *>
/**
* Helper function to perform the actual hangup action.
*
* @abstract
* @private
* @protected
* @returns {void}
*/
_doHangup() {

View File

@@ -150,11 +150,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
_maybeTranslateAttribute(text) {
const { t } = this.props;
if (typeof t === 'function') {
return t(text);
}
return text;
return typeof t === 'function' ? t(text) : text;
}
_onClick: (*) => void;
@@ -169,7 +165,7 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
_onClick(...args) {
const { disabled, onClick } = this.props;
!disabled && onClick && onClick(...args);
disabled || (onClick && onClick(...args));
}
/**
@@ -189,10 +185,6 @@ export default class AbstractToolboxItem<P : Props> extends Component<P> {
* @returns {ReactElement}
*/
render() {
if (!this.props.visible) {
return null;
}
return this._renderItem();
return this.props.visible ? this._renderItem() : null;
}
}

View File

@@ -17,7 +17,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
* Handles clicking / pressing the button, and toggles the video mute state
* accordingly.
*
* @private
* @protected
* @returns {void}
*/
_handleClick() {
@@ -28,7 +28,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
* Indicates whether this button is in toggled state or not.
*
* @override
* @private
* @protected
* @returns {boolean}
*/
_isToggled() {
@@ -37,10 +37,9 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
/**
* Helper function to be implemented by subclasses, which must return a
* boolean value indicating if video is muted or not.
* {@code boolean} value indicating if video is muted or not.
*
* @abstract
* @private
* @protected
* @returns {boolean}
*/
_isVideoMuted() {
@@ -52,7 +51,7 @@ export default class AbstractVideoMuteButton<P : Props, S : *>
* action.
*
* @param {boolean} videoMuted - Whether video should be muted or not.
* @private
* @protected
* @returns {void}
*/
_setVideoMuted(videoMuted: boolean) { // eslint-disable-line no-unused-vars

View File

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