Procházet zdrojové kódy

Comply w/ coding style

j8
Lyubo Marinov před 8 roky
rodič
revize
bc8c8c1bb9
1 změnil soubory, kde provedl 51 přidání a 50 odebrání
  1. 51
    50
      conference.js

+ 51
- 50
conference.js Zobrazit soubor

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

Načítá se…
Zrušit
Uložit