Comply w/ coding style

This commit is contained in:
Lyubo Marinov 2017-04-11 14:40:03 -05:00
parent cbc08eb96d
commit bc8c8c1bb9
1 changed files with 51 additions and 50 deletions

View File

@ -63,8 +63,10 @@ const ConnectionQualityEvents = JitsiMeetJS.events.connectionQuality;
const eventEmitter = new EventEmitter(); const eventEmitter = new EventEmitter();
let room, connection, localAudio, localVideo, let room;
initialAudioMutedState = false, initialVideoMutedState = false; let connection;
let localAudio, localVideo;
let initialAudioMutedState = false, initialVideoMutedState = false;
/** /**
* Indicates whether extension external installation is in progress or not. * Indicates whether extension external installation is in progress or not.
@ -177,7 +179,7 @@ function createInitialLocalTracksAndConnect(roomName) {
* @param command the command * @param command the command
* @param {string} value new value * @param {string} value new value
*/ */
function sendData (command, value) { function sendData(command, value) {
if(!room) { if(!room) {
return; return;
} }
@ -214,7 +216,7 @@ function _setupLocalParticipantProperties() {
* @param {string} id user id * @param {string} id user id
* @returns {string?} user nickname or undefined if user is unknown. * @returns {string?} user nickname or undefined if user is unknown.
*/ */
function getDisplayName (id) { function getDisplayName(id) {
if (APP.conference.isLocalId(id)) { if (APP.conference.isLocalId(id)) {
return APP.settings.getDisplayName(); return APP.settings.getDisplayName();
} }
@ -231,7 +233,7 @@ function getDisplayName (id) {
* @param {boolean} userInteraction - indicates if this local audio mute was a * @param {boolean} userInteraction - indicates if this local audio mute was a
* result of user interaction * result of user interaction
*/ */
function muteLocalAudio (muted) { function muteLocalAudio(muted) {
muteLocalMedia(localAudio, muted, 'Audio'); muteLocalMedia(localAudio, muted, 'Audio');
} }
@ -251,7 +253,7 @@ function muteLocalMedia(localMedia, muted, localMediaTypeString) {
* Mute or unmute local video stream if it exists. * Mute or unmute local video stream if it exists.
* @param {boolean} muted if video stream should be muted or unmuted. * @param {boolean} muted if video stream should be muted or unmuted.
*/ */
function muteLocalVideo (muted) { function muteLocalVideo(muted) {
muteLocalMedia(localVideo, muted, 'Video'); muteLocalMedia(localVideo, muted, 'Video');
} }
@ -336,7 +338,7 @@ function assignWindowLocationPathname(pathname) {
* for gUM permission prompt * for gUM permission prompt
* @returns {Promise<JitsiLocalTrack[]>} * @returns {Promise<JitsiLocalTrack[]>}
*/ */
function createLocalTracks (options, checkForPermissionPrompt) { function createLocalTracks(options, checkForPermissionPrompt) {
options || (options = {}); options || (options = {});
return JitsiMeetJS return JitsiMeetJS
@ -637,14 +639,14 @@ export default {
* @param {string} id id to check * @param {string} id id to check
* @returns {boolean} * @returns {boolean}
*/ */
isLocalId (id) { isLocalId(id) {
return this.getMyUserId() === id; return this.getMyUserId() === id;
}, },
/** /**
* Simulates toolbar button click for audio mute. Used by shortcuts and API. * Simulates toolbar button click for audio mute. Used by shortcuts and API.
* @param mute true for mute and false for unmute. * @param mute true for mute and false for unmute.
*/ */
muteAudio (mute) { muteAudio(mute) {
muteLocalAudio(mute); muteLocalAudio(mute);
}, },
/** /**
@ -661,7 +663,7 @@ export default {
* will be executed after the track is created. Otherwise the operation * will be executed after the track is created. Otherwise the operation
* will be ignored. * will be ignored.
*/ */
toggleAudioMuted (force = false) { toggleAudioMuted(force = false) {
if(!localAudio && force) { if(!localAudio && force) {
initialAudioMutedState = !initialAudioMutedState; initialAudioMutedState = !initialAudioMutedState;
return; return;
@ -672,7 +674,7 @@ export default {
* Simulates toolbar button click for video mute. Used by shortcuts and API. * Simulates toolbar button click for video mute. Used by shortcuts and API.
* @param mute true for mute and false for unmute. * @param mute true for mute and false for unmute.
*/ */
muteVideo (mute) { muteVideo(mute) {
muteLocalVideo(mute); muteLocalVideo(mute);
}, },
/** /**
@ -681,7 +683,7 @@ export default {
* will be executed after the track is created. Otherwise the operation * will be executed after the track is created. Otherwise the operation
* will be ignored. * will be ignored.
*/ */
toggleVideoMuted (force = false) { toggleVideoMuted(force = false) {
if(!localVideo && force) { if(!localVideo && force) {
initialVideoMutedState = !initialVideoMutedState; initialVideoMutedState = !initialVideoMutedState;
return; return;
@ -692,14 +694,14 @@ export default {
* Retrieve list of conference participants (without local user). * Retrieve list of conference participants (without local user).
* @returns {JitsiParticipant[]} * @returns {JitsiParticipant[]}
*/ */
listMembers () { listMembers() {
return room.getParticipants(); return room.getParticipants();
}, },
/** /**
* Retrieve list of ids of conference participants (without local user). * Retrieve list of ids of conference participants (without local user).
* @returns {string[]} * @returns {string[]}
*/ */
listMembersIds () { listMembersIds() {
return room.getParticipants().map(p => p.getId()); return room.getParticipants().map(p => p.getId());
}, },
/** /**
@ -707,7 +709,7 @@ export default {
* @id id to search for participant * @id id to search for participant
* @return {boolean} whether the participant is moderator * @return {boolean} whether the participant is moderator
*/ */
isParticipantModerator (id) { isParticipantModerator(id) {
let user = room.getParticipantById(id); let user = room.getParticipantById(id);
return user && user.isModerator(); return user && user.isModerator();
}, },
@ -715,10 +717,10 @@ export default {
* Check if SIP is supported. * Check if SIP is supported.
* @returns {boolean} * @returns {boolean}
*/ */
sipGatewayEnabled () { sipGatewayEnabled() {
return room.isSIPCallingSupported(); return room.isSIPCallingSupported();
}, },
get membersCount () { get membersCount() {
return room.getParticipants().length + 1; return room.getParticipants().length + 1;
}, },
/** /**
@ -728,7 +730,7 @@ export default {
* @returns true if the callstats integration is enabled, otherwise returns * @returns true if the callstats integration is enabled, otherwise returns
* false. * false.
*/ */
isCallstatsEnabled () { isCallstatsEnabled() {
return room && room.isCallstatsEnabled(); return room && room.isCallstatsEnabled();
}, },
/** /**
@ -738,7 +740,7 @@ export default {
* user feedback * user feedback
* @param detailedFeedback detailed feedback from the user. Not yet used * @param detailedFeedback detailed feedback from the user. Not yet used
*/ */
sendFeedback (overallFeedback, detailedFeedback) { sendFeedback(overallFeedback, detailedFeedback) {
return room.sendFeedback (overallFeedback, detailedFeedback); return room.sendFeedback (overallFeedback, detailedFeedback);
}, },
@ -756,15 +758,15 @@ export default {
/** /**
* Returns the connection times stored in the library. * Returns the connection times stored in the library.
*/ */
getConnectionTimes () { getConnectionTimes() {
return this._room.getConnectionTimes(); return this._room.getConnectionTimes();
}, },
// used by torture currently // used by torture currently
isJoined () { isJoined() {
return this._room return this._room
&& this._room.isJoined(); && this._room.isJoined();
}, },
getConnectionState () { getConnectionState() {
return this._room return this._room
&& this._room.getConnectionState(); && this._room.getConnectionState();
}, },
@ -773,7 +775,7 @@ export default {
* @return {string|null} ICE connection state or <tt>null</tt> if there's no * @return {string|null} ICE connection state or <tt>null</tt> if there's no
* P2P connection * P2P connection
*/ */
getP2PConnectionState () { getP2PConnectionState() {
return this._room return this._room
&& this._room.getP2PConnectionState(); && this._room.getP2PConnectionState();
}, },
@ -781,7 +783,7 @@ export default {
* Starts P2P (for tests only) * Starts P2P (for tests only)
* @private * @private
*/ */
_startP2P () { _startP2P() {
try { try {
this._room && this._room.startP2PSession(); this._room && this._room.startP2PSession();
} catch (error) { } catch (error) {
@ -793,7 +795,7 @@ export default {
* Stops P2P (for tests only) * Stops P2P (for tests only)
* @private * @private
*/ */
_stopP2P () { _stopP2P() {
try { try {
this._room && this._room.stopP2PSession(); this._room && this._room.stopP2PSession();
} catch (error) { } catch (error) {
@ -808,7 +810,7 @@ export default {
* @returns {boolean} true if the connection is in interrupted state or * @returns {boolean} true if the connection is in interrupted state or
* false otherwise. * false otherwise.
*/ */
isConnectionInterrupted () { isConnectionInterrupted() {
return this._room.isConnectionInterrupted(); return this._room.isConnectionInterrupted();
}, },
/** /**
@ -819,7 +821,7 @@ export default {
* @returns {JitsiParticipant|null} participant instance for given id or * @returns {JitsiParticipant|null} participant instance for given id or
* null if not found. * null if not found.
*/ */
getParticipantById (id) { getParticipantById(id) {
return room ? room.getParticipantById(id) : null; return room ? room.getParticipantById(id) : null;
}, },
/** /**
@ -830,10 +832,9 @@ export default {
* @returns {ParticipantConnectionStatus|null} the status of the participant * @returns {ParticipantConnectionStatus|null} the status of the participant
* or null if no such participant is found or participant is the local user. * or null if no such participant is found or participant is the local user.
*/ */
getParticipantConnectionStatus (id) { getParticipantConnectionStatus(id) {
let participant = this.getParticipantById(id); let participant = this.getParticipantById(id);
return participant return participant ? participant.getConnectionStatus() : null;
? participant.getConnectionStatus() : null;
}, },
/** /**
* Gets the display name foe the <tt>JitsiParticipant</tt> identified by * Gets the display name foe the <tt>JitsiParticipant</tt> identified by
@ -844,7 +845,7 @@ export default {
* @return {string} the participant's display name or the default string if * @return {string} the participant's display name or the default string if
* absent. * absent.
*/ */
getParticipantDisplayName (id) { getParticipantDisplayName(id) {
let displayName = getDisplayName(id); let displayName = getDisplayName(id);
if (displayName) { if (displayName) {
return displayName; return displayName;
@ -857,7 +858,7 @@ export default {
} }
} }
}, },
getMyUserId () { getMyUserId() {
return this._room return this._room
&& this._room.myUserId(); && this._room.myUserId();
}, },
@ -883,7 +884,7 @@ export default {
* @param id the id for the user audio level to return (the id value is * @param id the id for the user audio level to return (the id value is
* returned for the participant using getMyUserId() method) * returned for the participant using getMyUserId() method)
*/ */
getPeerSSRCAudioLevel (id) { getPeerSSRCAudioLevel(id) {
return this.audioLevelsMap[id]; return this.audioLevelsMap[id];
}, },
/** /**
@ -903,7 +904,7 @@ export default {
}, },
// end used by torture // end used by torture
getLogs () { getLogs() {
return room.getLogs(); return room.getLogs();
}, },
@ -912,7 +913,7 @@ export default {
* debugging. * debugging.
* @param filename (optional) specify target filename * @param filename (optional) specify target filename
*/ */
saveLogs (filename = 'meetlog.json') { saveLogs(filename = 'meetlog.json') {
// this can be called from console and will not have reference to this // this can be called from console and will not have reference to this
// that's why we reference the global var // that's why we reference the global var
let logs = APP.conference.getLogs(); let logs = APP.conference.getLogs();
@ -1022,13 +1023,13 @@ export default {
}, },
/** /**
* Start using provided video stream. * Start using provided video stream.
* Stops previous video stream. * Stops previous video stream.
* @param {JitsiLocalTrack} [stream] new stream to use or null * @param {JitsiLocalTrack} [stream] new stream to use or null
* @returns {Promise} * @returns {Promise}
*/ */
useVideoStream (newStream) { useVideoStream(newStream) {
return room.replaceTrack(localVideo, newStream) return room.replaceTrack(localVideo, newStream)
.then(() => { .then(() => {
// We call dispose after doing the replace because // We call dispose after doing the replace because
@ -1072,7 +1073,7 @@ export default {
* @param {JitsiLocalTrack} [stream] new stream to use or null * @param {JitsiLocalTrack} [stream] new stream to use or null
* @returns {Promise} * @returns {Promise}
*/ */
useAudioStream (newStream) { useAudioStream(newStream) {
return room.replaceTrack(localAudio, newStream) return room.replaceTrack(localAudio, newStream)
.then(() => { .then(() => {
// We call dispose after doing the replace because // We call dispose after doing the replace because
@ -1105,7 +1106,7 @@ export default {
}, },
videoSwitchInProgress: false, videoSwitchInProgress: false,
toggleScreenSharing (shareScreen = !this.isSharingScreen) { toggleScreenSharing(shareScreen = !this.isSharingScreen) {
if (this.videoSwitchInProgress) { if (this.videoSwitchInProgress) {
logger.warn("Switch in progress."); logger.warn("Switch in progress.");
return; return;
@ -1228,7 +1229,7 @@ export default {
/** /**
* Setup interaction between conference and UI. * Setup interaction between conference and UI.
*/ */
_setupListeners () { _setupListeners() {
// add local streams when joined to the conference // add local streams when joined to the conference
room.on(ConferenceEvents.CONFERENCE_JOINED, () => { room.on(ConferenceEvents.CONFERENCE_JOINED, () => {
APP.store.dispatch(conferenceJoined(room)); APP.store.dispatch(conferenceJoined(room));
@ -1938,7 +1939,7 @@ export default {
* @param {boolean} [requestFeedback=false] if user feedback should be * @param {boolean} [requestFeedback=false] if user feedback should be
* requested * requested
*/ */
hangup (requestFeedback = false) { hangup(requestFeedback = false) {
eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP); eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
APP.UI.hideRingOverLay(); APP.UI.hideRingOverLay();
let requestFeedbackPromise = requestFeedback let requestFeedbackPromise = requestFeedback
@ -2016,7 +2017,7 @@ export default {
* @throws NetworkError or InvalidStateError or Error if the operation * @throws NetworkError or InvalidStateError or Error if the operation
* fails. * fails.
*/ */
sendEndpointMessage (to, payload) { sendEndpointMessage(to, payload) {
room.sendEndpointMessage(to, payload); room.sendEndpointMessage(to, payload);
}, },
@ -2025,7 +2026,7 @@ export default {
* @param {String} eventName the name of the event * @param {String} eventName the name of the event
* @param {Function} listener the listener. * @param {Function} listener the listener.
*/ */
addListener (eventName, listener) { addListener(eventName, listener) {
eventEmitter.addListener(eventName, listener); eventEmitter.addListener(eventName, listener);
}, },
@ -2035,7 +2036,7 @@ export default {
* listener * listener
* @param {Function} listener the listener. * @param {Function} listener the listener.
*/ */
removeListener (eventName, listener) { removeListener(eventName, listener) {
eventEmitter.removeListener(eventName, listener); eventEmitter.removeListener(eventName, listener);
}, },
@ -2048,7 +2049,7 @@ export default {
* is currently in the last N set or if there's no last N set at this point * is currently in the last N set or if there's no last N set at this point
* and {false} otherwise * and {false} otherwise
*/ */
isInLastN (participantId) { isInLastN(participantId) {
return room.isInLastN(participantId); return room.isInLastN(participantId);
}, },
/** /**