[flow] Expand the coverage of flow-monitored files

This commit is contained in:
Lyubomir Marinov 2017-02-03 12:51:12 -06:00 committed by hristoterezov
parent 5de1a74429
commit b50f858556
6 changed files with 31 additions and 21 deletions

View File

@ -1,3 +1,5 @@
/* @flow */
/** /**
* Returns current domain. * Returns current domain.
* *
@ -5,7 +7,7 @@
* state. * state.
* @returns {(string|undefined)} * @returns {(string|undefined)}
*/ */
export function getDomain(stateOrGetState) { export function getDomain(stateOrGetState: Function | Object) {
const state const state
= typeof stateOrGetState === 'function' = typeof stateOrGetState === 'function'
? stateOrGetState() ? stateOrGetState()

View File

@ -1,3 +1,5 @@
/* @flow */
import { ReducerRegistry, setStateProperty } from '../redux'; import { ReducerRegistry, setStateProperty } from '../redux';
import { import {
@ -9,20 +11,22 @@ import {
/** /**
* Reduces the Redux actions of the feature base/connection. * Reduces the Redux actions of the feature base/connection.
*/ */
ReducerRegistry.register('features/base/connection', (state = {}, action) => { ReducerRegistry.register(
switch (action.type) { 'features/base/connection',
case CONNECTION_DISCONNECTED: (state: Object = {}, action: Object) => {
return _connectionDisconnected(state, action); switch (action.type) {
case CONNECTION_DISCONNECTED:
return _connectionDisconnected(state, action);
case CONNECTION_ESTABLISHED: case CONNECTION_ESTABLISHED:
return _connectionEstablished(state, action); return _connectionEstablished(state, action);
case SET_DOMAIN: case SET_DOMAIN:
return _setDomain(state, action); return _setDomain(state, action);
} }
return state; return state;
}); });
/** /**
* Reduces a specific Redux action CONNECTION_DISCONNECTED of the feature * Reduces a specific Redux action CONNECTION_DISCONNECTED of the feature
@ -34,7 +38,7 @@ ReducerRegistry.register('features/base/connection', (state = {}, action) => {
* @returns {Object} The new state of the feature base/connection after the * @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action. * reduction of the specified action.
*/ */
function _connectionDisconnected(state, action) { function _connectionDisconnected(state: Object, action: Object) {
if (state.connection === action.connection) { if (state.connection === action.connection) {
return setStateProperty(state, 'connection', undefined); return setStateProperty(state, 'connection', undefined);
} }
@ -52,7 +56,7 @@ function _connectionDisconnected(state, action) {
* @returns {Object} The new state of the feature base/connection after the * @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action. * reduction of the specified action.
*/ */
function _connectionEstablished(state, action) { function _connectionEstablished(state: Object, action: Object) {
return setStateProperty(state, 'connection', action.connection); return setStateProperty(state, 'connection', action.connection);
} }
@ -65,7 +69,7 @@ function _connectionEstablished(state, action) {
* @private * @private
* @returns {Object} * @returns {Object}
*/ */
function _constructConnectionOptions(domain) { function _constructConnectionOptions(domain: string) {
// FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both // FIXME The HTTPS scheme for the BOSH URL works with meet.jit.si on both
// mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately, // mobile & Web. It also works with beta.meet.jit.si on Web. Unfortunately,
// it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the // it doesn't work with beta.meet.jit.si on mobile. Temporarily, use the
@ -89,7 +93,7 @@ function _constructConnectionOptions(domain) {
boshProtocol || (boshProtocol = 'https:'); boshProtocol || (boshProtocol = 'https:');
return { return {
bosh: `${boshProtocol}//${domain}/http-bind`, bosh: `${String(boshProtocol)}//${domain}/http-bind`,
hosts: { hosts: {
domain, domain,
focus: `focus.${domain}`, focus: `focus.${domain}`,
@ -107,7 +111,7 @@ function _constructConnectionOptions(domain) {
* @returns {Object} The new state of the feature base/connection after the * @returns {Object} The new state of the feature base/connection after the
* reduction of the specified action. * reduction of the specified action.
*/ */
function _setDomain(state, action) { function _setDomain(state: Object, action: Object) {
return { return {
...state, ...state,
connectionOptions: { connectionOptions: {

View File

@ -1,3 +1,5 @@
/* @flow */
import { CONFERENCE_LEFT } from '../conference'; import { CONFERENCE_LEFT } from '../conference';
import { MiddlewareRegistry } from '../redux'; import { MiddlewareRegistry } from '../redux';
import { setTrackMuted, TRACK_ADDED } from '../tracks'; import { setTrackMuted, TRACK_ADDED } from '../tracks';

View File

@ -19,7 +19,7 @@ type Route = {
* without needing to create additional inter-feature dependencies. * without needing to create additional inter-feature dependencies.
*/ */
class RouteRegistry { class RouteRegistry {
_elements: Route[]; _elements: Array<Route>;
/** /**
* Initializes a new RouteRegistry instance. * Initializes a new RouteRegistry instance.

View File

@ -1,3 +1,5 @@
/* @flow */
import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet'; import { LIB_DISPOSED, LIB_INITIALIZED } from '../lib-jitsi-meet';
import { import {
MEDIA_TYPE, MEDIA_TYPE,
@ -67,7 +69,7 @@ MiddlewareRegistry.register(store => next => action => {
* @returns {Track} The local <tt>Track</tt> associated with the specified * @returns {Track} The local <tt>Track</tt> associated with the specified
* <tt>mediaType</tt> in the specified <tt>store</tt>. * <tt>mediaType</tt> in the specified <tt>store</tt>.
*/ */
function _getLocalTrack(store, mediaType) { function _getLocalTrack(store, mediaType: MEDIA_TYPE) {
return getLocalTrack(store.getState()['features/base/tracks'], mediaType); return getLocalTrack(store.getState()['features/base/tracks'], mediaType);
} }
@ -82,7 +84,7 @@ function _getLocalTrack(store, mediaType) {
* @private * @private
* @returns {void} * @returns {void}
*/ */
function _setMuted(store, action, mediaType) { function _setMuted(store, action, mediaType: MEDIA_TYPE) {
const localTrack = _getLocalTrack(store, mediaType); const localTrack = _getLocalTrack(store, mediaType);
localTrack && setTrackMuted(localTrack.jitsiTrack, action.muted); localTrack && setTrackMuted(localTrack.jitsiTrack, action.muted);

View File

@ -152,7 +152,7 @@ const _CONJUNCTION_ = [
* Maps a string (category name) to the array of words from that category. * Maps a string (category name) to the array of words from that category.
* @const * @const
*/ */
const CATEGORIES = { const CATEGORIES: { [key: string]: Array<string> } = {
_ADJECTIVE_, _ADJECTIVE_,
_ADVERB_, _ADVERB_,
_PLURALNOUN_, _PLURALNOUN_,