Use Symbol for Redux action types to prevent conflicts
This commit is contained in:
parent
f58d7fc3cc
commit
daf56455a5
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../base/react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the actions which signals that a specific App will mount (in the
|
* The type of the actions which signals that a specific App will mount (in the
|
||||||
* terms of React).
|
* terms of React).
|
||||||
|
@ -7,7 +9,7 @@
|
||||||
* app: App
|
* app: App
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const APP_WILL_MOUNT = 'APP_WILL_MOUNT';
|
export const APP_WILL_MOUNT = Symbol('APP_WILL_MOUNT');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the actions which signals that a specific App will unmount (in
|
* The type of the actions which signals that a specific App will unmount (in
|
||||||
|
@ -18,4 +20,4 @@ export const APP_WILL_MOUNT = 'APP_WILL_MOUNT';
|
||||||
* app: App
|
* app: App
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const APP_WILL_UNMOUNT = 'APP_WILL_UNMOUNT';
|
export const APP_WILL_UNMOUNT = Symbol('APP_WILL_UNMOUNT');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal that we are joining the conference.
|
* Action type to signal that we are joining the conference.
|
||||||
*
|
*
|
||||||
|
@ -8,7 +10,7 @@
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const CONFERENCE_JOINED = 'CONFERENCE_JOINED';
|
export const CONFERENCE_JOINED = Symbol('CONFERENCE_JOINED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal that we have left the conference.
|
* Action type to signal that we have left the conference.
|
||||||
|
@ -20,7 +22,7 @@ export const CONFERENCE_JOINED = 'CONFERENCE_JOINED';
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const CONFERENCE_LEFT = 'CONFERENCE_LEFT';
|
export const CONFERENCE_LEFT = Symbol('CONFERENCE_LEFT');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal that we will leave the specified conference.
|
* Action type to signal that we will leave the specified conference.
|
||||||
|
@ -32,7 +34,7 @@ export const CONFERENCE_LEFT = 'CONFERENCE_LEFT';
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const CONFERENCE_WILL_LEAVE = 'CONFERENCE_WILL_LEAVE';
|
export const CONFERENCE_WILL_LEAVE = Symbol('CONFERENCE_WILL_LEAVE');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the Redux action which sets the name of the room of the
|
* The type of the Redux action which sets the name of the room of the
|
||||||
|
@ -43,4 +45,4 @@ export const CONFERENCE_WILL_LEAVE = 'CONFERENCE_WILL_LEAVE';
|
||||||
* room: string
|
* room: string
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const SET_ROOM = 'SET_ROOM';
|
export const SET_ROOM = Symbol('SET_ROOM');
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal that connection has disconnected.
|
* Action type to signal that connection has disconnected.
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
*/
|
*/
|
||||||
export const CONNECTION_DISCONNECTED = 'CONNECTION_DISCONNECTED';
|
export const CONNECTION_DISCONNECTED = Symbol('CONNECTION_DISCONNECTED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal that have successfully established a connection.
|
* Action type to signal that have successfully established a connection.
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
*/
|
*/
|
||||||
export const CONNECTION_ESTABLISHED = 'CONNECTION_ESTABLISHED';
|
export const CONNECTION_ESTABLISHED = Symbol('CONNECTION_ESTABLISHED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action type to signal a connection failed.
|
* Action type to signal a connection failed.
|
||||||
*
|
|
||||||
* @type {string}
|
|
||||||
*/
|
*/
|
||||||
export const CONNECTION_FAILED = 'CONNECTION_FAILED';
|
export const CONNECTION_FAILED = Symbol('CONNECTION_FAILED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal to change connection domain.
|
* Action to signal to change connection domain.
|
||||||
|
@ -27,4 +23,4 @@ export const CONNECTION_FAILED = 'CONNECTION_FAILED';
|
||||||
* domain: string
|
* domain: string
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const SET_DOMAIN = 'SET_DOMAIN';
|
export const SET_DOMAIN = Symbol('SET_DOMAIN');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that lib-jitsi-meet library was disposed.
|
* Action to signal that lib-jitsi-meet library was disposed.
|
||||||
*
|
*
|
||||||
|
@ -5,7 +7,7 @@
|
||||||
* type: LIB_DISPOSED
|
* type: LIB_DISPOSED
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const LIB_DISPOSED = 'LIB_DISPOSED';
|
export const LIB_DISPOSED = Symbol('LIB_DISPOSED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that lib-jitsi-meet initialized failed with error.
|
* Action to signal that lib-jitsi-meet initialized failed with error.
|
||||||
|
@ -15,7 +17,7 @@ export const LIB_DISPOSED = 'LIB_DISPOSED';
|
||||||
* error: Error
|
* error: Error
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const LIB_INIT_ERROR = 'LIB_INIT_ERROR';
|
export const LIB_INIT_ERROR = Symbol('LIB_INIT_ERROR');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that lib-jitsi-meet initialization succeeded.
|
* Action to signal that lib-jitsi-meet initialization succeeded.
|
||||||
|
@ -24,7 +26,7 @@ export const LIB_INIT_ERROR = 'LIB_INIT_ERROR';
|
||||||
* type: LIB_INITIALIZED
|
* type: LIB_INITIALIZED
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const LIB_INITIALIZED = 'LIB_INITIALIZED';
|
export const LIB_INITIALIZED = Symbol('LIB_INITIALIZED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that config was set.
|
* Action to signal that config was set.
|
||||||
|
@ -34,4 +36,4 @@ export const LIB_INITIALIZED = 'LIB_INITIALIZED';
|
||||||
* config: Object
|
* config: Object
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const SET_CONFIG = 'SET_CONFIG';
|
export const SET_CONFIG = Symbol('SET_CONFIG');
|
||||||
|
|
|
@ -85,6 +85,9 @@ function _visitNode(node, callback) {
|
||||||
|
|
||||||
(global => {
|
(global => {
|
||||||
|
|
||||||
|
// Polyfill for URL constructor
|
||||||
|
require('url-polyfill');
|
||||||
|
|
||||||
const DOMParser = require('xmldom').DOMParser;
|
const DOMParser = require('xmldom').DOMParser;
|
||||||
|
|
||||||
// addEventListener
|
// addEventListener
|
||||||
|
@ -210,30 +213,6 @@ function _visitNode(node, callback) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// performance
|
|
||||||
if (typeof global.performance === 'undefined') {
|
|
||||||
global.performance = {
|
|
||||||
now() {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
// sessionStorage
|
|
||||||
//
|
|
||||||
// Required by:
|
|
||||||
// - Strophe
|
|
||||||
if (typeof global.sessionStorage === 'undefined') {
|
|
||||||
global.sessionStorage = {
|
|
||||||
/* eslint-disable no-empty-function */
|
|
||||||
getItem() {},
|
|
||||||
removeItem() {},
|
|
||||||
setItem() {}
|
|
||||||
|
|
||||||
/* eslint-enable no-empty-function */
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const navigator = global.navigator;
|
const navigator = global.navigator;
|
||||||
|
|
||||||
if (navigator) {
|
if (navigator) {
|
||||||
|
@ -280,6 +259,30 @@ function _visitNode(node, callback) {
|
||||||
})();
|
})();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// performance
|
||||||
|
if (typeof global.performance === 'undefined') {
|
||||||
|
global.performance = {
|
||||||
|
now() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// sessionStorage
|
||||||
|
//
|
||||||
|
// Required by:
|
||||||
|
// - Strophe
|
||||||
|
if (typeof global.sessionStorage === 'undefined') {
|
||||||
|
global.sessionStorage = {
|
||||||
|
/* eslint-disable no-empty-function */
|
||||||
|
getItem() {},
|
||||||
|
removeItem() {},
|
||||||
|
setItem() {}
|
||||||
|
|
||||||
|
/* eslint-enable no-empty-function */
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
// WebRTC
|
// WebRTC
|
||||||
require('./polyfills-webrtc');
|
require('./polyfills-webrtc');
|
||||||
|
|
||||||
|
@ -310,7 +313,4 @@ function _visitNode(node, callback) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Polyfill for URL constructor
|
|
||||||
require('url-polyfill');
|
|
||||||
|
|
||||||
})(global || window || this); // eslint-disable-line no-invalid-this
|
})(global || window || this); // eslint-disable-line no-invalid-this
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to change muted state of the local audio.
|
* Action to change muted state of the local audio.
|
||||||
*
|
*
|
||||||
|
@ -6,7 +8,7 @@
|
||||||
* muted: boolean
|
* muted: boolean
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED';
|
export const AUDIO_MUTED_CHANGED = Symbol('AUDIO_MUTED_CHANGED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal a change of the facing mode of the local video camera.
|
* Action to signal a change of the facing mode of the local video camera.
|
||||||
|
@ -16,7 +18,7 @@ export const AUDIO_MUTED_CHANGED = 'AUDIO_MUTED_CHANGED';
|
||||||
* cameraFacingMode: CAMERA_FACING_MODE
|
* cameraFacingMode: CAMERA_FACING_MODE
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const CAMERA_FACING_MODE_CHANGED = 'CAMERA_FACING_MODE_CHANGED';
|
export const CAMERA_FACING_MODE_CHANGED = Symbol('CAMERA_FACING_MODE_CHANGED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to change muted state of the local video.
|
* Action to change muted state of the local video.
|
||||||
|
@ -26,4 +28,4 @@ export const CAMERA_FACING_MODE_CHANGED = 'CAMERA_FACING_MODE_CHANGED';
|
||||||
* muted: boolean
|
* muted: boolean
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const VIDEO_MUTED_CHANGED = 'VIDEO_MUTED_CHANGED';
|
export const VIDEO_MUTED_CHANGED = Symbol('VIDEO_MUTED_CHANGED');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an action for when dominant speaker changes.
|
* Create an action for when dominant speaker changes.
|
||||||
*
|
*
|
||||||
|
@ -8,7 +10,7 @@
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const DOMINANT_SPEAKER_CHANGED = 'DOMINANT_SPEAKER_CHANGED';
|
export const DOMINANT_SPEAKER_CHANGED = Symbol('DOMINANT_SPEAKER_CHANGED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that ID of participant has changed. This happens when
|
* Action to signal that ID of participant has changed. This happens when
|
||||||
|
@ -20,7 +22,7 @@ export const DOMINANT_SPEAKER_CHANGED = 'DOMINANT_SPEAKER_CHANGED';
|
||||||
* oldValue: string
|
* oldValue: string
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
|
export const PARTICIPANT_ID_CHANGED = Symbol('PARTICIPANT_ID_CHANGED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to signal that a participant has joined.
|
* Action to signal that a participant has joined.
|
||||||
|
@ -30,7 +32,7 @@ export const PARTICIPANT_ID_CHANGED = 'PARTICIPANT_ID_CHANGED';
|
||||||
* participant: Participant
|
* participant: Participant
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
|
export const PARTICIPANT_JOINED = Symbol('PARTICIPANT_JOINED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to handle case when participant lefts.
|
* Action to handle case when participant lefts.
|
||||||
|
@ -42,7 +44,7 @@ export const PARTICIPANT_JOINED = 'PARTICIPANT_JOINED';
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const PARTICIPANT_LEFT = 'PARTICIPANT_LEFT';
|
export const PARTICIPANT_LEFT = Symbol('PARTICIPANT_LEFT');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to handle case when info about participant changes.
|
* Action to handle case when info about participant changes.
|
||||||
|
@ -52,7 +54,7 @@ export const PARTICIPANT_LEFT = 'PARTICIPANT_LEFT';
|
||||||
* participant: Participant
|
* participant: Participant
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const PARTICIPANT_UPDATED = 'PARTICIPANT_UPDATED';
|
export const PARTICIPANT_UPDATED = Symbol('PARTICIPANT_UPDATED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The type of the Redux action which pins a conference participant.
|
* The type of the Redux action which pins a conference participant.
|
||||||
|
@ -64,4 +66,4 @@ export const PARTICIPANT_UPDATED = 'PARTICIPANT_UPDATED';
|
||||||
* }
|
* }
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const PIN_PARTICIPANT = 'PIN_PARTICIPANT';
|
export const PIN_PARTICIPANT = Symbol('PIN_PARTICIPANT');
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
// FIXME React Native does not polyfill Symbol at versions 0.39.2 or earlier.
|
||||||
|
export default (global => {
|
||||||
|
let s = global.Symbol;
|
||||||
|
|
||||||
|
if (typeof s === 'undefined') {
|
||||||
|
// XXX At the time of this writing we use Symbol only as a way to
|
||||||
|
// prevent collisions in Redux action types. Consequently, the Symbol
|
||||||
|
// implementation provided bellow is minimal and specific to our
|
||||||
|
// purpose.
|
||||||
|
s = description => (description || '').split('');
|
||||||
|
}
|
||||||
|
|
||||||
|
return s;
|
||||||
|
})(global || window || this); // eslint-disable-line no-invalid-this
|
|
@ -1,2 +1,3 @@
|
||||||
export * from './components';
|
export * from './components';
|
||||||
export * from './functions';
|
export * from './functions';
|
||||||
|
export { default as Symbol } from './Symbol';
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action for when a track has been added to the conference,
|
* Action for when a track has been added to the conference,
|
||||||
* local or remote.
|
* local or remote.
|
||||||
|
@ -7,7 +9,7 @@
|
||||||
* track: Track
|
* track: Track
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const TRACK_ADDED = 'TRACK_ADDED';
|
export const TRACK_ADDED = Symbol('TRACK_ADDED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action for when a track has been removed from the conference,
|
* Action for when a track has been removed from the conference,
|
||||||
|
@ -18,7 +20,7 @@ export const TRACK_ADDED = 'TRACK_ADDED';
|
||||||
* track: Track
|
* track: Track
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const TRACK_REMOVED = 'TRACK_REMOVED';
|
export const TRACK_REMOVED = Symbol('TRACK_REMOVED');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action for when a track properties were updated.
|
* Action for when a track properties were updated.
|
||||||
|
@ -28,4 +30,4 @@ export const TRACK_REMOVED = 'TRACK_REMOVED';
|
||||||
* track: Track
|
* track: Track
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const TRACK_UPDATED = 'TRACK_UPDATED';
|
export const TRACK_UPDATED = Symbol('TRACK_UPDATED');
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
import { Component } from 'react';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements a React Component which depicts a specific participant's avatar
|
|
||||||
* and video.
|
|
||||||
*/
|
|
||||||
export default class ParticipantView extends Component {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Implements React's {@link Component#render()}.
|
|
||||||
*
|
|
||||||
* @inheritdoc
|
|
||||||
* @returns {ReactElement|null}
|
|
||||||
*/
|
|
||||||
render() {
|
|
||||||
// FIXME ParticipantView is supposed to be platform-independent.
|
|
||||||
// Temporarily though, ParticipantView is not in use on Web but has to
|
|
||||||
// exist in order to split App, Conference, and WelcomePage out of
|
|
||||||
// index.html.
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { Symbol } from '../base/react';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Action to change the participant to be displayed in LargeVideo.
|
* Action to change the participant to be displayed in LargeVideo.
|
||||||
*
|
*
|
||||||
|
@ -7,4 +9,4 @@
|
||||||
* }
|
* }
|
||||||
*/
|
*/
|
||||||
export const LARGE_VIDEO_PARTICIPANT_CHANGED
|
export const LARGE_VIDEO_PARTICIPANT_CHANGED
|
||||||
= 'LARGE_VIDEO_PARTICIPANT_CHANGED';
|
= Symbol('LARGE_VIDEO_PARTICIPANT_CHANGED');
|
||||||
|
|
Loading…
Reference in New Issue