Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
Coding style
Lyubo Marinov7954d5fd393a
diff --git a/react/features/app/components/AbstractApp.js b/react/features/app/components/AbstractApp.jsindex 1ef67aa42c..d29ef19922 100644--- a/react/features/app/components/AbstractApp.js+++ b/react/features/app/components/AbstractApp.js@@ -12,13 +12,13 @@ import {localParticipantJoined,localParticipantLeft} from '../../base/participants';+import { getProfile } from '../../base/profile';import { Fragment, RouteRegistry } from '../../base/react';import {MiddlewareRegistry,PersistencyRegistry,ReducerRegistry} from '../../base/redux';-import { getProfile } from '../../base/profile';import { toURLString } from '../../base/util';import { OverlayContainer } from '../../overlay';import { BlankPage } from '../../welcome';@@ -346,9 +346,11 @@ export class AbstractApp extends Component {middleware = compose(middleware, devToolsExtension());}- return createStore(- reducer, PersistencyRegistry.getPersistedState(), middleware- );+ return (+ createStore(+ reducer,+ PersistencyRegistry.getPersistedState(),+ middleware));}/**diff --git a/react/features/base/profile/reducer.js b/react/features/base/profile/reducer.jsindex e406e177b1..d0b3489b5b 100644--- a/react/features/base/profile/reducer.js+++ b/react/features/base/profile/reducer.js@@ -1,11 +1,9 @@// @flow-import {- PROFILE_UPDATED-} from './actionTypes';-import { PersistencyRegistry, ReducerRegistry } from '../redux';+import { PROFILE_UPDATED } from './actionTypes';+const DEFAULT_STATE = {profile: {}};diff --git a/react/features/base/react/prop-types-polyfill.js b/react/features/base/react/prop-types-polyfill.jsindex 4131cef222..24424cf507 100644--- a/react/features/base/react/prop-types-polyfill.js+++ b/react/features/base/react/prop-types-polyfill.js@@ -2,7 +2,9 @@ import React from 'react';import PropTypes from 'prop-types';/* eslint-disable react/no-deprecated */+if (typeof React.PropTypes === 'undefined') {React.PropTypes = PropTypes;}+/* eslint-enable react/no-deprecated */diff --git a/react/features/base/redux/PersistencyRegistry.js b/react/features/base/redux/PersistencyRegistry.jsindex 766212cf15..a7af9eddfa 100644--- a/react/features/base/redux/PersistencyRegistry.js+++ b/react/features/base/redux/PersistencyRegistry.js@@ -1,4 +1,5 @@// @flow+import Logger from 'jitsi-meet-logger';import md5 from 'js-md5';@@ -15,25 +16,26 @@ const PERSISTED_STATE_NAME = 'jitsi-state';declare type PersistencyConfigMap = { [name: string]: Object };/**- * A registry to allow features to register their redux store- * subtree to be persisted and also handles the persistency calls too.+ * A registry to allow features to register their redux store subtree to be+ * persisted and also handles the persistency calls too.*/class PersistencyRegistry {_checksum: string;+_elements: PersistencyConfigMap;/**- * Initiates the PersistencyRegistry.+ * Initializes a new {@ code PersistencyRegistry} instance.*/constructor() {this._elements = {};}/**- * Returns the persisted redux state. This function takes- * the PersistencyRegistry._elements into account as we may have- * persisted something in the past that we don't want to retreive anymore.- * The next {@link #persistState} will remove those values.+ * Returns the persisted redux state. This function takes the+ * {@link #_elements} into account as we may have persisted something in the+ * past that we don't want to retreive anymore. The next+ * {@link #persistState} will remove those values.** @returns {Object}*/@@ -46,8 +48,9 @@ class PersistencyRegistry {persistedState = JSON.parse(persistedState);} catch (error) {logger.error(- 'Error parsing persisted state', persistedState, error- );+ 'Error parsing persisted state',+ persistedState,+ error);persistedState = {};}@@ -56,14 +59,14 @@ class PersistencyRegistry {}this._checksum = this._calculateChecksum(filteredPersistedState);- logger.info('Redux state rehydrated as', filteredPersistedState);+ logger.info('redux state rehydrated as', filteredPersistedState);return filteredPersistedState;}/**- * Initiates a persist operation, but its execution will depend on- * the current checksums (checks changes).+ * Initiates a persist operation, but its execution will depend on the+ * current checksums (checks changes).** @param {Object} state - The redux state.* @returns {void}@@ -76,14 +79,13 @@ class PersistencyRegistry {try {window.localStorage.setItem(PERSISTED_STATE_NAME,- JSON.stringify(filteredState)- );+ JSON.stringify(filteredState));logger.info(- `Redux state persisted. ${this._checksum} -> ${newCheckSum}`- );+ `redux state persisted. ${this._checksum} -> ${+ newCheckSum}`);this._checksum = newCheckSum;} catch (error) {- logger.error('Error persisting Redux state', error);+ logger.error('Error persisting redux state', error);}}}@@ -103,7 +105,7 @@ class PersistencyRegistry {* Calculates the checksum of the current or the new values of the state.** @private- * @param {Object} filteredState - The filtered/persisted Redux state.+ * @param {Object} filteredState - The filtered/persisted redux state.* @returns {string}*/_calculateChecksum(filteredState: Object) {@@ -111,16 +113,17 @@ class PersistencyRegistry {return md5.hex(JSON.stringify(filteredState) || '');} catch (error) {logger.error(- 'Error calculating checksum for state', filteredState, error- );+ 'Error calculating checksum for state',+ filteredState,+ error);return '';}}/**- * Prepares a filtered state from the actual or the- * persisted Redux state, based on this registry.+ * Prepares a filtered state from the actual or the persisted redux state,+ * based on this registry.** @private* @param {Object} state - The actual or persisted redux state.@@ -131,10 +134,10 @@ class PersistencyRegistry {for (const name of Object.keys(this._elements)) {if (state[name]) {- filteredState[name] = this._getFilteredSubtree(- state[name],- this._elements[name]- );+ filteredState[name]+ = this._getFilteredSubtree(+ state[name],+ this._elements[name]);}}@@ -142,8 +145,8 @@ class PersistencyRegistry {}/**- * Prepares a filtered subtree based on the config for- * persisting or for retreival.+ * Prepares a filtered subtree based on the config for persisting or for+ * retrieval.** @private* @param {Object} subtree - The redux state subtree.@@ -155,8 +158,7 @@ class PersistencyRegistry {for (const persistedKey of Object.keys(subtree)) {if (subtreeConfig[persistedKey]) {- filteredSubtree[persistedKey]- = subtree[persistedKey];+ filteredSubtree[persistedKey] = subtree[persistedKey];}}diff --git a/react/features/base/redux/functions.js b/react/features/base/redux/functions.jsindex 687eb06f42..d671806e0f 100644--- a/react/features/base/redux/functions.js+++ b/react/features/base/redux/functions.js@@ -1,4 +1,4 @@-/* @flow */+// @flowimport _ from 'lodash';diff --git a/react/features/base/redux/middleware.js b/react/features/base/redux/middleware.jsindex 682868a324..4548343c52 100644--- a/react/features/base/redux/middleware.js+++ b/react/features/base/redux/middleware.js@@ -1,28 +1,29 @@-/* @flow */+// @flow+import _ from 'lodash';+import { toState } from './functions';import MiddlewareRegistry from './MiddlewareRegistry';import PersistencyRegistry from './PersistencyRegistry';-import { toState } from '../redux';-/**- * The delay that passes between the last state change and the state to be- * persisted in the storage.+ * The delay that passes between the last state change and the persisting of+ * that state in the storage.*/-const PERSIST_DELAY = 2000;+const PERSIST_STATE_DELAY = 2000;/*** A throttled function to avoid repetitive state persisting.*/-const throttledFunc = _.throttle(state => {- PersistencyRegistry.persistState(state);-}, PERSIST_DELAY);+const throttledPersistState+ = _.throttle(+ state => PersistencyRegistry.persistState(state),+ PERSIST_STATE_DELAY);/*** A master MiddleWare to selectively persist state. Please use the- * {@link persisterconfig.json} to set which subtrees of the Redux state- * should be persisted.+ * {@link persisterconfig.json} to set which subtrees of the Redux state should+ * be persisted.** @param {Store} store - The redux store.* @returns {Function}@@ -30,7 +31,7 @@ const throttledFunc = _.throttle(state => {MiddlewareRegistry.register(store => next => action => {const result = next(action);- throttledFunc(toState(store));+ throttledPersistState(toState(store));return result;});diff --git a/react/features/recent-list/actions.js b/react/features/recent-list/actions.jsindex 6c7dfe2147..eb126021f2 100644--- a/react/features/recent-list/actions.js+++ b/react/features/recent-list/actions.js@@ -10,8 +10,8 @@ import {** @param {Object} locationURL - The current location URL.* @returns {{- * type: STORE_CURRENT_CONFERENCE,- * locationURL: Object+ * type: STORE_CURRENT_CONFERENCE,+ * locationURL: Object* }}*/export function storeCurrentConference(locationURL: Object) {@@ -26,8 +26,8 @@ export function storeCurrentConference(locationURL: Object) {** @param {Object} locationURL - The current location URL.* @returns {{- * type: UPDATE_CONFERENCE_DURATION,- * locationURL: Object+ * type: UPDATE_CONFERENCE_DURATION,+ * locationURL: Object* }}*/export function updateConferenceDuration(locationURL: Object) {diff --git a/react/features/recent-list/components/RecentList.native.js b/react/features/recent-list/components/RecentList.native.jsindex 71effacb19..11a442a357 100644--- a/react/features/recent-list/components/RecentList.native.js+++ b/react/features/recent-list/components/RecentList.native.js@@ -2,12 +2,11 @@ import React from 'react';import { ListView, Text, TouchableHighlight, View } from 'react-native';import { connect } from 'react-redux';-import AbstractRecentList, { _mapStateToProps } from './AbstractRecentList';-import styles, { UNDERLAY_COLOR } from './styles';+import { Icon } from '../../base/font-icons';+import AbstractRecentList, { _mapStateToProps } from './AbstractRecentList';import { getRecentRooms } from '../functions';--import { Icon } from '../../base/font-icons';+import styles, { UNDERLAY_COLOR } from './styles';/*** The native container rendering the list of the recently joined rooms.@@ -52,9 +51,9 @@ class RecentList extends AbstractRecentList {return null;}- const listViewDataSource = this.dataSource.cloneWithRows(- getRecentRooms(this.props._recentList)- );+ const listViewDataSource+ = this.dataSource.cloneWithRows(+ getRecentRooms(this.props._recentList));return (<View style = { styles.container }>diff --git a/react/features/recent-list/functions.js b/react/features/recent-list/functions.jsindex e59fb1a490..c8e2809db4 100644--- a/react/features/recent-list/functions.js+++ b/react/features/recent-list/functions.js@@ -2,16 +2,11 @@import moment from 'moment';-import { i18next } from '../base/i18n';-import { parseURIString } from '../base/util';--/**- * MomentJS uses static language bundle loading, so in order to support dynamic- * language selection in the app we need to load all bundles that we support in- * the app.- * FIXME: If we decide to support MomentJS in other features as well we may need- * to move this import and the lenient matcher to the i18n feature.- */+// MomentJS uses static language bundle loading, so in order to support dynamic+// language selection in the app we need to load all bundles that we support in+// the app.+// FIXME: If we decide to support MomentJS in other features as well we may need+// to move this import and the lenient matcher to the i18n feature.require('moment/locale/bg');require('moment/locale/de');require('moment/locale/eo');@@ -33,6 +28,9 @@ require('moment/locale/sv');require('moment/locale/tr');require('moment/locale/zh-cn');+import { i18next } from '../base/i18n';+import { parseURIString } from '../base/util';+/*** Retrieves the recent room list and generates all the data needed to be* displayed.@@ -122,14 +120,14 @@ function _getInitials(room: string) {}/**- * Returns a localized date formatter initialized with the provided date- * (@code Date) or duration (@code number).+ * Returns a localized date formatter initialized with a specific {@code Date}+ * or duration ({@code number}).** @private* @param {Date | number} dateOrDuration - The date or duration to format.- * @param {string} locale - The locale to init the formatter with. Note: This- * locale must be supported by the formatter so ensure this prerequisite before- * invoking the function.+ * @param {string} locale - The locale to init the formatter with. Note: The+ * specified locale must be supported by the formatter so ensure the+ * prerequisite is met before invoking the function.* @returns {Object}*/function _getLocalizedFormatter(dateOrDuration: Date | number, locale: string) {diff --git a/react/features/recent-list/reducer.js b/react/features/recent-list/reducer.jsindex d80ff7d858..ca4dcafe9b 100644--- a/react/features/recent-list/reducer.js+++ b/react/features/recent-list/reducer.js@@ -1,13 +1,13 @@// @flow+import { PersistencyRegistry, ReducerRegistry } from '../base/redux';+import {STORE_CURRENT_CONFERENCE,UPDATE_CONFERENCE_DURATION} from './actionTypes';import { LIST_SIZE } from './constants';-import { PersistencyRegistry, ReducerRegistry } from '../base/redux';-/*** The initial state of this feature.*/@@ -34,8 +34,10 @@ ReducerRegistry.register(STORE_NAME, (state = DEFAULT_STATE, action) => {switch (action.type) {case STORE_CURRENT_CONFERENCE:return _storeCurrentConference(state, action);+case UPDATE_CONFERENCE_DURATION:return _updateConferenceDuration(state, action);+default:return state;}@@ -54,9 +56,7 @@ function _storeCurrentConference(state, action) {// If the current conference is already in the list, we remove it to re-add// it to the top.- const list- = state.list- .filter(e => e.conference !== conference);+ const list = state.list.filter(e => e.conference !== conference);// This is a reverse sorted array (i.e. newer elements at the end).list.push({