Browse Source

Comply w/ coding style

j8
Lyubo Marinov 8 years ago
parent
commit
bc8c8c1bb9
1 changed files with 51 additions and 50 deletions
  1. 51
    50
      conference.js

+ 51
- 50
conference.js View File

63
 
63
 
64
 const eventEmitter = new EventEmitter();
64
 const eventEmitter = new EventEmitter();
65
 
65
 
66
-let room, connection, localAudio, localVideo,
67
-    initialAudioMutedState = false, initialVideoMutedState = false;
66
+let room;
67
+let connection;
68
+let localAudio, localVideo;
69
+let initialAudioMutedState = false, initialVideoMutedState = false;
68
 
70
 
69
 /**
71
 /**
70
  * Indicates whether extension external installation is in progress or not.
72
  * Indicates whether extension external installation is in progress or not.
177
  * @param command the command
179
  * @param command the command
178
  * @param {string} value new value
180
  * @param {string} value new value
179
  */
181
  */
180
-function sendData (command, value) {
182
+function sendData(command, value) {
181
     if(!room) {
183
     if(!room) {
182
         return;
184
         return;
183
     }
185
     }
214
  * @param {string} id user id
216
  * @param {string} id user id
215
  * @returns {string?} user nickname or undefined if user is unknown.
217
  * @returns {string?} user nickname or undefined if user is unknown.
216
  */
218
  */
217
-function getDisplayName (id) {
219
+function getDisplayName(id) {
218
     if (APP.conference.isLocalId(id)) {
220
     if (APP.conference.isLocalId(id)) {
219
         return APP.settings.getDisplayName();
221
         return APP.settings.getDisplayName();
220
     }
222
     }
231
  * @param {boolean} userInteraction - indicates if this local audio mute was a
233
  * @param {boolean} userInteraction - indicates if this local audio mute was a
232
  * result of user interaction
234
  * result of user interaction
233
  */
235
  */
234
-function muteLocalAudio (muted) {
236
+function muteLocalAudio(muted) {
235
     muteLocalMedia(localAudio, muted, 'Audio');
237
     muteLocalMedia(localAudio, muted, 'Audio');
236
 }
238
 }
237
 
239
 
251
  * Mute or unmute local video stream if it exists.
253
  * Mute or unmute local video stream if it exists.
252
  * @param {boolean} muted if video stream should be muted or unmuted.
254
  * @param {boolean} muted if video stream should be muted or unmuted.
253
  */
255
  */
254
-function muteLocalVideo (muted) {
256
+function muteLocalVideo(muted) {
255
     muteLocalMedia(localVideo, muted, 'Video');
257
     muteLocalMedia(localVideo, muted, 'Video');
256
 }
258
 }
257
 
259
 
336
  *      for gUM permission prompt
338
  *      for gUM permission prompt
337
  * @returns {Promise<JitsiLocalTrack[]>}
339
  * @returns {Promise<JitsiLocalTrack[]>}
338
  */
340
  */
339
-function createLocalTracks (options, checkForPermissionPrompt) {
341
+function createLocalTracks(options, checkForPermissionPrompt) {
340
     options || (options = {});
342
     options || (options = {});
341
 
343
 
342
     return JitsiMeetJS
344
     return JitsiMeetJS
637
      * @param {string} id id to check
639
      * @param {string} id id to check
638
      * @returns {boolean}
640
      * @returns {boolean}
639
      */
641
      */
640
-    isLocalId (id) {
642
+    isLocalId(id) {
641
         return this.getMyUserId() === id;
643
         return this.getMyUserId() === id;
642
     },
644
     },
643
     /**
645
     /**
644
      * Simulates toolbar button click for audio mute. Used by shortcuts and API.
646
      * Simulates toolbar button click for audio mute. Used by shortcuts and API.
645
      * @param mute true for mute and false for unmute.
647
      * @param mute true for mute and false for unmute.
646
      */
648
      */
647
-    muteAudio (mute) {
649
+    muteAudio(mute) {
648
         muteLocalAudio(mute);
650
         muteLocalAudio(mute);
649
     },
651
     },
650
     /**
652
     /**
661
      * will be executed after the track is created. Otherwise the operation
663
      * will be executed after the track is created. Otherwise the operation
662
      * will be ignored.
664
      * will be ignored.
663
      */
665
      */
664
-    toggleAudioMuted (force = false) {
666
+    toggleAudioMuted(force = false) {
665
         if(!localAudio && force) {
667
         if(!localAudio && force) {
666
             initialAudioMutedState = !initialAudioMutedState;
668
             initialAudioMutedState = !initialAudioMutedState;
667
             return;
669
             return;
672
      * Simulates toolbar button click for video mute. Used by shortcuts and API.
674
      * Simulates toolbar button click for video mute. Used by shortcuts and API.
673
      * @param mute true for mute and false for unmute.
675
      * @param mute true for mute and false for unmute.
674
      */
676
      */
675
-    muteVideo (mute) {
677
+    muteVideo(mute) {
676
         muteLocalVideo(mute);
678
         muteLocalVideo(mute);
677
     },
679
     },
678
     /**
680
     /**
681
      * will be executed after the track is created. Otherwise the operation
683
      * will be executed after the track is created. Otherwise the operation
682
      * will be ignored.
684
      * will be ignored.
683
      */
685
      */
684
-    toggleVideoMuted (force = false) {
686
+    toggleVideoMuted(force = false) {
685
         if(!localVideo && force) {
687
         if(!localVideo && force) {
686
             initialVideoMutedState = !initialVideoMutedState;
688
             initialVideoMutedState = !initialVideoMutedState;
687
             return;
689
             return;
692
      * Retrieve list of conference participants (without local user).
694
      * Retrieve list of conference participants (without local user).
693
      * @returns {JitsiParticipant[]}
695
      * @returns {JitsiParticipant[]}
694
      */
696
      */
695
-    listMembers () {
697
+    listMembers() {
696
         return room.getParticipants();
698
         return room.getParticipants();
697
     },
699
     },
698
     /**
700
     /**
699
      * Retrieve list of ids of conference participants (without local user).
701
      * Retrieve list of ids of conference participants (without local user).
700
      * @returns {string[]}
702
      * @returns {string[]}
701
      */
703
      */
702
-    listMembersIds () {
704
+    listMembersIds() {
703
         return room.getParticipants().map(p => p.getId());
705
         return room.getParticipants().map(p => p.getId());
704
     },
706
     },
705
     /**
707
     /**
707
      * @id id to search for participant
709
      * @id id to search for participant
708
      * @return {boolean} whether the participant is moderator
710
      * @return {boolean} whether the participant is moderator
709
      */
711
      */
710
-    isParticipantModerator (id) {
712
+    isParticipantModerator(id) {
711
         let user = room.getParticipantById(id);
713
         let user = room.getParticipantById(id);
712
         return user && user.isModerator();
714
         return user && user.isModerator();
713
     },
715
     },
715
      * Check if SIP is supported.
717
      * Check if SIP is supported.
716
      * @returns {boolean}
718
      * @returns {boolean}
717
      */
719
      */
718
-    sipGatewayEnabled () {
720
+    sipGatewayEnabled() {
719
         return room.isSIPCallingSupported();
721
         return room.isSIPCallingSupported();
720
     },
722
     },
721
-    get membersCount () {
723
+    get membersCount() {
722
         return room.getParticipants().length + 1;
724
         return room.getParticipants().length + 1;
723
     },
725
     },
724
     /**
726
     /**
728
      * @returns true if the callstats integration is enabled, otherwise returns
730
      * @returns true if the callstats integration is enabled, otherwise returns
729
      * false.
731
      * false.
730
      */
732
      */
731
-    isCallstatsEnabled () {
733
+    isCallstatsEnabled() {
732
         return room && room.isCallstatsEnabled();
734
         return room && room.isCallstatsEnabled();
733
     },
735
     },
734
     /**
736
     /**
738
      * user feedback
740
      * user feedback
739
      * @param detailedFeedback detailed feedback from the user. Not yet used
741
      * @param detailedFeedback detailed feedback from the user. Not yet used
740
      */
742
      */
741
-    sendFeedback (overallFeedback, detailedFeedback) {
743
+    sendFeedback(overallFeedback, detailedFeedback) {
742
         return room.sendFeedback (overallFeedback, detailedFeedback);
744
         return room.sendFeedback (overallFeedback, detailedFeedback);
743
     },
745
     },
744
 
746
 
756
     /**
758
     /**
757
      * Returns the connection times stored in the library.
759
      * Returns the connection times stored in the library.
758
      */
760
      */
759
-    getConnectionTimes () {
761
+    getConnectionTimes() {
760
         return this._room.getConnectionTimes();
762
         return this._room.getConnectionTimes();
761
     },
763
     },
762
     // used by torture currently
764
     // used by torture currently
763
-    isJoined () {
765
+    isJoined() {
764
         return this._room
766
         return this._room
765
             && this._room.isJoined();
767
             && this._room.isJoined();
766
     },
768
     },
767
-    getConnectionState () {
769
+    getConnectionState() {
768
         return this._room
770
         return this._room
769
             && this._room.getConnectionState();
771
             && this._room.getConnectionState();
770
     },
772
     },
773
      * @return {string|null} ICE connection state or <tt>null</tt> if there's no
775
      * @return {string|null} ICE connection state or <tt>null</tt> if there's no
774
      * P2P connection
776
      * P2P connection
775
      */
777
      */
776
-    getP2PConnectionState () {
778
+    getP2PConnectionState() {
777
         return this._room
779
         return this._room
778
             && this._room.getP2PConnectionState();
780
             && this._room.getP2PConnectionState();
779
     },
781
     },
781
      * Starts P2P (for tests only)
783
      * Starts P2P (for tests only)
782
      * @private
784
      * @private
783
      */
785
      */
784
-    _startP2P () {
786
+    _startP2P() {
785
         try {
787
         try {
786
             this._room && this._room.startP2PSession();
788
             this._room && this._room.startP2PSession();
787
         } catch (error) {
789
         } catch (error) {
793
      * Stops P2P (for tests only)
795
      * Stops P2P (for tests only)
794
      * @private
796
      * @private
795
      */
797
      */
796
-    _stopP2P () {
798
+    _stopP2P() {
797
         try {
799
         try {
798
             this._room && this._room.stopP2PSession();
800
             this._room && this._room.stopP2PSession();
799
         } catch (error) {
801
         } catch (error) {
808
      * @returns {boolean} true if the connection is in interrupted state or
810
      * @returns {boolean} true if the connection is in interrupted state or
809
      * false otherwise.
811
      * false otherwise.
810
      */
812
      */
811
-    isConnectionInterrupted () {
813
+    isConnectionInterrupted() {
812
         return this._room.isConnectionInterrupted();
814
         return this._room.isConnectionInterrupted();
813
     },
815
     },
814
     /**
816
     /**
819
      * @returns {JitsiParticipant|null} participant instance for given id or
821
      * @returns {JitsiParticipant|null} participant instance for given id or
820
      * null if not found.
822
      * null if not found.
821
      */
823
      */
822
-    getParticipantById (id) {
824
+    getParticipantById(id) {
823
         return room ? room.getParticipantById(id) : null;
825
         return room ? room.getParticipantById(id) : null;
824
     },
826
     },
825
     /**
827
     /**
830
      * @returns {ParticipantConnectionStatus|null} the status of the participant
832
      * @returns {ParticipantConnectionStatus|null} the status of the participant
831
      * or null if no such participant is found or participant is the local user.
833
      * or null if no such participant is found or participant is the local user.
832
      */
834
      */
833
-    getParticipantConnectionStatus (id) {
835
+    getParticipantConnectionStatus(id) {
834
         let participant = this.getParticipantById(id);
836
         let participant = this.getParticipantById(id);
835
-        return participant
836
-            ? participant.getConnectionStatus() : null;
837
+        return participant ? participant.getConnectionStatus() : null;
837
     },
838
     },
838
     /**
839
     /**
839
      * Gets the display name foe the <tt>JitsiParticipant</tt> identified by
840
      * Gets the display name foe the <tt>JitsiParticipant</tt> identified by
844
      * @return {string} the participant's display name or the default string if
845
      * @return {string} the participant's display name or the default string if
845
      * absent.
846
      * absent.
846
      */
847
      */
847
-    getParticipantDisplayName (id) {
848
+    getParticipantDisplayName(id) {
848
         let displayName = getDisplayName(id);
849
         let displayName = getDisplayName(id);
849
         if (displayName) {
850
         if (displayName) {
850
             return displayName;
851
             return displayName;
857
             }
858
             }
858
         }
859
         }
859
     },
860
     },
860
-    getMyUserId () {
861
+    getMyUserId() {
861
         return this._room
862
         return this._room
862
             && this._room.myUserId();
863
             && this._room.myUserId();
863
     },
864
     },
883
      * @param id the id for the user audio level to return (the id value is
884
      * @param id the id for the user audio level to return (the id value is
884
      *          returned for the participant using getMyUserId() method)
885
      *          returned for the participant using getMyUserId() method)
885
      */
886
      */
886
-    getPeerSSRCAudioLevel (id) {
887
+    getPeerSSRCAudioLevel(id) {
887
         return this.audioLevelsMap[id];
888
         return this.audioLevelsMap[id];
888
     },
889
     },
889
     /**
890
     /**
903
     },
904
     },
904
     // end used by torture
905
     // end used by torture
905
 
906
 
906
-    getLogs () {
907
+    getLogs() {
907
         return room.getLogs();
908
         return room.getLogs();
908
     },
909
     },
909
 
910
 
912
      * debugging.
913
      * debugging.
913
      * @param filename (optional) specify target filename
914
      * @param filename (optional) specify target filename
914
      */
915
      */
915
-    saveLogs (filename = 'meetlog.json') {
916
+    saveLogs(filename = 'meetlog.json') {
916
         // this can be called from console and will not have reference to this
917
         // this can be called from console and will not have reference to this
917
         // that's why we reference the global var
918
         // that's why we reference the global var
918
         let logs = APP.conference.getLogs();
919
         let logs = APP.conference.getLogs();
1022
     },
1023
     },
1023
 
1024
 
1024
 
1025
 
1025
-  /**
1026
-   * Start using provided video stream.
1027
-   * Stops previous video stream.
1028
-   * @param {JitsiLocalTrack} [stream] new stream to use or null
1029
-   * @returns {Promise}
1030
-   */
1031
-    useVideoStream (newStream) {
1026
+    /**
1027
+     * Start using provided video stream.
1028
+     * Stops previous video stream.
1029
+     * @param {JitsiLocalTrack} [stream] new stream to use or null
1030
+     * @returns {Promise}
1031
+     */
1032
+    useVideoStream(newStream) {
1032
         return room.replaceTrack(localVideo, newStream)
1033
         return room.replaceTrack(localVideo, newStream)
1033
             .then(() => {
1034
             .then(() => {
1034
                 // We call dispose after doing the replace because
1035
                 // We call dispose after doing the replace because
1072
      * @param {JitsiLocalTrack} [stream] new stream to use or null
1073
      * @param {JitsiLocalTrack} [stream] new stream to use or null
1073
      * @returns {Promise}
1074
      * @returns {Promise}
1074
      */
1075
      */
1075
-    useAudioStream (newStream) {
1076
+    useAudioStream(newStream) {
1076
         return room.replaceTrack(localAudio, newStream)
1077
         return room.replaceTrack(localAudio, newStream)
1077
             .then(() => {
1078
             .then(() => {
1078
                 // We call dispose after doing the replace because
1079
                 // We call dispose after doing the replace because
1105
     },
1106
     },
1106
 
1107
 
1107
     videoSwitchInProgress: false,
1108
     videoSwitchInProgress: false,
1108
-    toggleScreenSharing (shareScreen = !this.isSharingScreen) {
1109
+    toggleScreenSharing(shareScreen = !this.isSharingScreen) {
1109
         if (this.videoSwitchInProgress) {
1110
         if (this.videoSwitchInProgress) {
1110
             logger.warn("Switch in progress.");
1111
             logger.warn("Switch in progress.");
1111
             return;
1112
             return;
1228
     /**
1229
     /**
1229
      * Setup interaction between conference and UI.
1230
      * Setup interaction between conference and UI.
1230
      */
1231
      */
1231
-    _setupListeners () {
1232
+    _setupListeners() {
1232
         // add local streams when joined to the conference
1233
         // add local streams when joined to the conference
1233
         room.on(ConferenceEvents.CONFERENCE_JOINED, () => {
1234
         room.on(ConferenceEvents.CONFERENCE_JOINED, () => {
1234
             APP.store.dispatch(conferenceJoined(room));
1235
             APP.store.dispatch(conferenceJoined(room));
1938
      * @param {boolean} [requestFeedback=false] if user feedback should be
1939
      * @param {boolean} [requestFeedback=false] if user feedback should be
1939
      * requested
1940
      * requested
1940
      */
1941
      */
1941
-    hangup (requestFeedback = false) {
1942
+    hangup(requestFeedback = false) {
1942
         eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
1943
         eventEmitter.emit(JitsiMeetConferenceEvents.BEFORE_HANGUP);
1943
         APP.UI.hideRingOverLay();
1944
         APP.UI.hideRingOverLay();
1944
         let requestFeedbackPromise = requestFeedback
1945
         let requestFeedbackPromise = requestFeedback
2016
      * @throws NetworkError or InvalidStateError or Error if the operation
2017
      * @throws NetworkError or InvalidStateError or Error if the operation
2017
      * fails.
2018
      * fails.
2018
      */
2019
      */
2019
-    sendEndpointMessage (to, payload) {
2020
+    sendEndpointMessage(to, payload) {
2020
         room.sendEndpointMessage(to, payload);
2021
         room.sendEndpointMessage(to, payload);
2021
     },
2022
     },
2022
 
2023
 
2025
      * @param {String} eventName the name of the event
2026
      * @param {String} eventName the name of the event
2026
      * @param {Function} listener the listener.
2027
      * @param {Function} listener the listener.
2027
      */
2028
      */
2028
-    addListener (eventName, listener) {
2029
+    addListener(eventName, listener) {
2029
         eventEmitter.addListener(eventName, listener);
2030
         eventEmitter.addListener(eventName, listener);
2030
     },
2031
     },
2031
 
2032
 
2035
      * listener
2036
      * listener
2036
      * @param {Function} listener the listener.
2037
      * @param {Function} listener the listener.
2037
      */
2038
      */
2038
-    removeListener (eventName, listener) {
2039
+    removeListener(eventName, listener) {
2039
         eventEmitter.removeListener(eventName, listener);
2040
         eventEmitter.removeListener(eventName, listener);
2040
     },
2041
     },
2041
 
2042
 
2048
      * is currently in the last N set or if there's no last N set at this point
2049
      * is currently in the last N set or if there's no last N set at this point
2049
      * and {false} otherwise
2050
      * and {false} otherwise
2050
      */
2051
      */
2051
-    isInLastN (participantId) {
2052
+    isInLastN(participantId) {
2052
         return room.isInLastN(participantId);
2053
         return room.isInLastN(participantId);
2053
     },
2054
     },
2054
     /**
2055
     /**

Loading…
Cancel
Save