瀏覽代碼

Merge branch 'master' into eslint_improvements

dev1
hristoterezov 8 年之前
父節點
當前提交
9a86145f81

+ 5
- 0
.eslintrc.js 查看文件

@@ -82,6 +82,11 @@ module.exports = {
82 82
         'brace-style': 2,
83 83
         'indent': [ 'error', 4, { 'SwitchCase': 0 } ],
84 84
 
85
+        'object-shorthand': [
86
+            'error',
87
+            'always',
88
+            { 'avoidQuotes': true }
89
+        ],
85 90
         'prefer-const': 2,
86 91
         'prefer-reflect': 0,
87 92
         'prefer-spread': 2,

+ 1
- 1
JitsiConference.js 查看文件

@@ -1409,7 +1409,7 @@ JitsiConference.prototype.getConnectionTimes = function () {
1409 1409
  * Sets a property for the local participant.
1410 1410
  */
1411 1411
 JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1412
-    this.sendCommand("jitsi_participant_" + name, {value: value});
1412
+    this.sendCommand("jitsi_participant_" + name, {value});
1413 1413
 };
1414 1414
 
1415 1415
 /**

+ 3
- 3
JitsiConferenceEventManager.js 查看文件

@@ -76,12 +76,12 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
76 76
             for (key in chatRoom.connectionTimes){
77 77
                 value = chatRoom.connectionTimes[key];
78 78
                 Statistics.analytics.sendEvent('conference.' + key,
79
-                    {value: value});
79
+                    {value});
80 80
             }
81 81
             for (key in chatRoom.xmpp.connectionTimes){
82 82
                 value = chatRoom.xmpp.connectionTimes[key];
83 83
                 Statistics.analytics.sendEvent('xmpp.' + key,
84
-                    {value: value});
84
+                    {value});
85 85
             }
86 86
         });
87 87
 
@@ -234,7 +234,7 @@ JitsiConferenceEventManager.prototype.setupChatRoomListeners = function () {
234 234
                 function (status, error) {
235 235
                     var logObject = {
236 236
                         id: "recorder_status",
237
-                        status: status
237
+                        status
238 238
                     };
239 239
                     if (error) {
240 240
                         logObject.error = error;

+ 2
- 2
JitsiConnection.js 查看文件

@@ -34,7 +34,7 @@ function JitsiConnection(appID, token, options) {
34 34
                     'connection.disconnected.' + msg);
35 35
             }
36 36
             Statistics.sendLog(
37
-                JSON.stringify({id: "connection.disconnected", msg: msg}));
37
+                JSON.stringify({id: "connection.disconnected", msg}));
38 38
         });
39 39
 }
40 40
 
@@ -92,7 +92,7 @@ JitsiConnection.prototype.setToken = function (token) {
92 92
  * @returns {JitsiConference} returns the new conference object.
93 93
  */
94 94
 JitsiConnection.prototype.initJitsiConference = function (name, options) {
95
-    return new JitsiConference({name: name, config: options, connection: this});
95
+    return new JitsiConference({name, config: options, connection: this});
96 96
 };
97 97
 
98 98
 /**

+ 9
- 9
JitsiMediaDevices.js 查看文件

@@ -41,7 +41,7 @@ var JitsiMediaDevices = {
41 41
      * Executes callback with list of media devices connected.
42 42
      * @param {function} callback
43 43
      */
44
-    enumerateDevices: function (callback) {
44
+    enumerateDevices (callback) {
45 45
         RTC.enumerateDevices(callback);
46 46
     },
47 47
     /**
@@ -50,7 +50,7 @@ var JitsiMediaDevices = {
50 50
      * the WebRTC stack is ready, either with true if the device listing is
51 51
      * available available or with false otherwise.
52 52
      */
53
-    isDeviceListAvailable: function () {
53
+    isDeviceListAvailable () {
54 54
         return RTC.isDeviceListAvailable();
55 55
     },
56 56
     /**
@@ -60,7 +60,7 @@ var JitsiMediaDevices = {
60 60
      *      undefined or 'input', 'output' - for audio output device change.
61 61
      * @returns {boolean} true if available, false otherwise.
62 62
      */
63
-    isDeviceChangeAvailable: function (deviceType) {
63
+    isDeviceChangeAvailable (deviceType) {
64 64
         return RTC.isDeviceChangeAvailable(deviceType);
65 65
     },
66 66
     /**
@@ -69,7 +69,7 @@ var JitsiMediaDevices = {
69 69
      *      undefined stands for both 'audio' and 'video' together
70 70
      * @returns {boolean}
71 71
      */
72
-    isDevicePermissionGranted: function (type) {
72
+    isDevicePermissionGranted (type) {
73 73
         var permissions = RTC.getDeviceAvailability();
74 74
 
75 75
         switch(type) {
@@ -86,7 +86,7 @@ var JitsiMediaDevices = {
86 86
      * for default device
87 87
      * @returns {string}
88 88
      */
89
-    getAudioOutputDevice: function () {
89
+    getAudioOutputDevice () {
90 90
         return RTC.getAudioOutputDevice();
91 91
     },
92 92
     /**
@@ -97,7 +97,7 @@ var JitsiMediaDevices = {
97 97
      * @returns {Promise} - resolves when audio output is changed, is rejected
98 98
      *      otherwise
99 99
      */
100
-    setAudioOutputDevice: function (deviceId) {
100
+    setAudioOutputDevice (deviceId) {
101 101
 
102 102
         var availableDevices = RTC.getCurrentlyAvailableMediaDevices();
103 103
         if (availableDevices && availableDevices.length > 0) {
@@ -114,7 +114,7 @@ var JitsiMediaDevices = {
114 114
      * @param {string} event - event name
115 115
      * @param {function} handler - event handler
116 116
      */
117
-    addEventListener: function (event, handler) {
117
+    addEventListener (event, handler) {
118 118
         eventEmitter.addListener(event, handler);
119 119
     },
120 120
     /**
@@ -122,14 +122,14 @@ var JitsiMediaDevices = {
122 122
      * @param {string} event - event name
123 123
      * @param {function} handler - event handler
124 124
      */
125
-    removeEventListener: function (event, handler) {
125
+    removeEventListener (event, handler) {
126 126
         eventEmitter.removeListener(event, handler);
127 127
     },
128 128
     /**
129 129
      * Emits an event.
130 130
      * @param {string} event - event name
131 131
      */
132
-    emitEvent: function (event) { // eslint-disable-line no-unused-vars
132
+    emitEvent (event) { // eslint-disable-line no-unused-vars
133 133
         eventEmitter.emit(...arguments);
134 134
     }
135 135
 };

+ 17
- 17
JitsiMeetJS.js 查看文件

@@ -77,7 +77,7 @@ var LibJitsiMeet = {
77 77
 
78 78
     version: '{#COMMIT_HASH#}',
79 79
 
80
-    JitsiConnection: JitsiConnection,
80
+    JitsiConnection,
81 81
     events: {
82 82
         conference: JitsiConferenceEvents,
83 83
         connection: JitsiConnectionEvents,
@@ -92,12 +92,12 @@ var LibJitsiMeet = {
92 92
         track: JitsiTrackErrors
93 93
     },
94 94
     errorTypes: {
95
-        JitsiTrackError: JitsiTrackError
95
+        JitsiTrackError
96 96
     },
97 97
     logLevels: Logger.levels,
98 98
     mediaDevices: JitsiMediaDevices,
99 99
     analytics: null,
100
-    init: function (options) {
100
+    init (options) {
101 101
         let logObject, attr;
102 102
         Statistics.init(options);
103 103
 
@@ -140,10 +140,10 @@ var LibJitsiMeet = {
140 140
      * Returns whether the desktop sharing is enabled or not.
141 141
      * @returns {boolean}
142 142
      */
143
-    isDesktopSharingEnabled: function () {
143
+    isDesktopSharingEnabled () {
144 144
         return RTC.isDesktopSharingEnabled();
145 145
     },
146
-    setLogLevel: function (level) {
146
+    setLogLevel (level) {
147 147
         Logger.setLogLevel(level);
148 148
     },
149 149
     /**
@@ -153,7 +153,7 @@ var LibJitsiMeet = {
153 153
      * Usually it's the name of the JavaScript source file including the path
154 154
      * ex. "modules/xmpp/ChatRoom.js"
155 155
      */
156
-    setLogLevelById: function (level, id) {
156
+    setLogLevelById (level, id) {
157 157
         Logger.setLogLevelById(level, id);
158 158
     },
159 159
     /**
@@ -161,7 +161,7 @@ var LibJitsiMeet = {
161 161
      * @param globalTransport
162 162
      * @see Logger.addGlobalTransport
163 163
      */
164
-    addGlobalLogTransport: function (globalTransport) {
164
+    addGlobalLogTransport (globalTransport) {
165 165
         Logger.addGlobalTransport(globalTransport);
166 166
     },
167 167
     /**
@@ -169,7 +169,7 @@ var LibJitsiMeet = {
169 169
      * @param globalTransport
170 170
      * @see Logger.removeGlobalTransport
171 171
      */
172
-    removeGlobalLogTransport: function (globalTransport) {
172
+    removeGlobalLogTransport (globalTransport) {
173 173
         Logger.removeGlobalTransport(globalTransport);
174 174
     },
175 175
     /**
@@ -211,7 +211,7 @@ var LibJitsiMeet = {
211 211
      *     A promise that returns an array of created JitsiTracks if resolved,
212 212
      *     or a JitsiConferenceError if rejected.
213 213
      */
214
-    createLocalTracks: function (options, firePermissionPromptIsShownEvent) {
214
+    createLocalTracks (options, firePermissionPromptIsShownEvent) {
215 215
         var promiseFulfilled = false;
216 216
 
217 217
         if (firePermissionPromptIsShownEvent === true) {
@@ -332,7 +332,7 @@ var LibJitsiMeet = {
332 332
      * available available or with false otherwise.
333 333
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceListAvailable instead
334 334
      */
335
-    isDeviceListAvailable: function () {
335
+    isDeviceListAvailable () {
336 336
         logger.warn('This method is deprecated, use ' +
337 337
             'JitsiMeetJS.mediaDevices.isDeviceListAvailable instead');
338 338
         return this.mediaDevices.isDeviceListAvailable();
@@ -345,7 +345,7 @@ var LibJitsiMeet = {
345 345
      * @returns {boolean} true if available, false otherwise.
346 346
      * @deprecated use JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead
347 347
      */
348
-    isDeviceChangeAvailable: function (deviceType) {
348
+    isDeviceChangeAvailable (deviceType) {
349 349
         logger.warn('This method is deprecated, use ' +
350 350
             'JitsiMeetJS.mediaDevices.isDeviceChangeAvailable instead');
351 351
         return this.mediaDevices.isDeviceChangeAvailable(deviceType);
@@ -355,7 +355,7 @@ var LibJitsiMeet = {
355 355
      * @param {function} callback
356 356
      * @deprecated use JitsiMeetJS.mediaDevices.enumerateDevices instead
357 357
      */
358
-    enumerateDevices: function (callback) {
358
+    enumerateDevices (callback) {
359 359
         logger.warn('This method is deprecated, use ' +
360 360
             'JitsiMeetJS.mediaDevices.enumerateDevices instead');
361 361
         this.mediaDevices.enumerateDevices(callback);
@@ -366,7 +366,7 @@ var LibJitsiMeet = {
366 366
      * the function used by the lib.
367 367
      * (function(message, source, lineno, colno, error)).
368 368
      */
369
-    getGlobalOnErrorHandler: function (message, source, lineno, colno, error) {
369
+    getGlobalOnErrorHandler (message, source, lineno, colno, error) {
370 370
         logger.error(
371 371
             'UnhandledError: ' + message,
372 372
             'Script: ' + source,
@@ -380,7 +380,7 @@ var LibJitsiMeet = {
380 380
      * Returns current machine id saved from the local storage.
381 381
      * @returns {string} the machine id
382 382
      */
383
-    getMachineId: function() {
383
+    getMachineId() {
384 384
         return Settings.getMachineId();
385 385
     },
386 386
 
@@ -389,9 +389,9 @@ var LibJitsiMeet = {
389 389
      * interest to LibJitsiMeet clients.
390 390
      */
391 391
     util: {
392
-        ScriptUtil: ScriptUtil,
393
-        RTCUIHelper: RTCUIHelper,
394
-        AuthUtil: AuthUtil
392
+        ScriptUtil,
393
+        RTCUIHelper,
394
+        AuthUtil
395 395
     }
396 396
 };
397 397
 

+ 1
- 1
modules/RTC/DataChannels.js 查看文件

@@ -275,7 +275,7 @@ DataChannels.prototype.send = function (jsonObject) {
275 275
 DataChannels.prototype.sendDataChannelMessage = function (to, payload) {
276 276
     this.send({
277 277
         colibriClass: "EndpointMessage",
278
-        to: to,
278
+        to,
279 279
         msgPayload: payload
280 280
     });
281 281
 };

+ 4
- 4
modules/RTC/RTCUIHelper.js 查看文件

@@ -10,7 +10,7 @@ var RTCUIHelper = {
10 10
      * currently using.
11 11
      * @returns {string} 'video' or 'object' string name of WebRTC video element
12 12
      */
13
-    getVideoElementName: function () {
13
+    getVideoElementName () {
14 14
         return RTCBrowserType.isTemasysPluginUsed() ? 'object' : 'video';
15 15
     },
16 16
 
@@ -21,7 +21,7 @@ var RTCUIHelper = {
21 21
      * @returns {HTMLElement} video HTML element instance if found inside of the
22 22
      *          container or undefined otherwise.
23 23
      */
24
-    findVideoElement: function (containerElement) {
24
+    findVideoElement (containerElement) {
25 25
         var videoElemName = RTCUIHelper.getVideoElementName();
26 26
         if (!RTCBrowserType.isTemasysPluginUsed()) {
27 27
             return $(containerElement).find(videoElemName)[0];
@@ -45,7 +45,7 @@ var RTCUIHelper = {
45 45
      * @param streamElement HTML element to which the RTC stream is attached to.
46 46
      * @param volume the volume value to be set.
47 47
      */
48
-    setVolume: function (streamElement, volume) {
48
+    setVolume (streamElement, volume) {
49 49
         if (!RTCBrowserType.isIExplorer()) {
50 50
             streamElement.volume = volume;
51 51
         }
@@ -56,7 +56,7 @@ var RTCUIHelper = {
56 56
      * @param streamElement HTML element to which the RTC stream is attached to.
57 57
      * @param autoPlay 'true' or 'false'
58 58
      */
59
-    setAutoPlay: function (streamElement, autoPlay) {
59
+    setAutoPlay (streamElement, autoPlay) {
60 60
         if (!RTCBrowserType.isIExplorer()) {
61 61
             streamElement.autoplay = autoPlay;
62 62
         }

+ 5
- 5
modules/RTC/RTCUtils.js 查看文件

@@ -178,7 +178,7 @@ function getConstraints(um, options) {
178 178
                 constraints.video.facingMode = facingMode;
179 179
             }
180 180
             constraints.video.optional.push({
181
-                facingMode: facingMode
181
+                facingMode
182 182
             });
183 183
         }
184 184
 
@@ -639,7 +639,7 @@ function handleLocalStream(streams, resolution) {
639 639
             track: videoStream.getVideoTracks()[0],
640 640
             mediaType: MediaType.VIDEO,
641 641
             videoType: VideoType.CAMERA,
642
-            resolution: resolution
642
+            resolution
643 643
         });
644 644
     }
645 645
 
@@ -1034,9 +1034,9 @@ class RTCUtils extends Listenable {
1034 1034
                 obtainDevices({
1035 1035
                     devices: options.devices,
1036 1036
                     streams: [],
1037
-                    successCallback: successCallback,
1037
+                    successCallback,
1038 1038
                     errorCallback: reject,
1039
-                    deviceGUM: deviceGUM
1039
+                    deviceGUM
1040 1040
                 });
1041 1041
             } else {
1042 1042
                 var hasDesktop = options.devices.indexOf('desktop') > -1;
@@ -1108,7 +1108,7 @@ class RTCUtils extends Listenable {
1108 1108
                                     dsOptions,
1109 1109
                                     function (desktopStream) {
1110 1110
                                         successCallback({audioVideo: stream,
1111
-                                            desktopStream: desktopStream});
1111
+                                            desktopStream});
1112 1112
                                     }, function (error) {
1113 1113
                                         self.stopMediaStream(stream);
1114 1114
 

+ 4
- 4
modules/RTC/TraceablePeerConnection.js 查看文件

@@ -563,13 +563,13 @@ var normalizePlanB = function(desc) {
563 563
 };
564 564
 
565 565
 var getters = {
566
-    signalingState: function () {
566
+    signalingState () {
567 567
         return this.peerconnection.signalingState;
568 568
     },
569
-    iceConnectionState: function () {
569
+    iceConnectionState () {
570 570
         return this.peerconnection.iceConnectionState;
571 571
     },
572
-    localDescription:  function() {
572
+    localDescription() {
573 573
         var desc = this.peerconnection.localDescription;
574 574
 
575 575
         this.trace('getLocalDescription::preTransform', dumpSDP(desc));
@@ -582,7 +582,7 @@ var getters = {
582 582
         }
583 583
         return desc;
584 584
     },
585
-    remoteDescription:  function() {
585
+    remoteDescription() {
586 586
         var desc = this.peerconnection.remoteDescription;
587 587
         this.trace('getRemoteDescription::preTransform', dumpSDP(desc));
588 588
 

+ 2
- 2
modules/statistics/AnalyticsAdapter.js 查看文件

@@ -24,8 +24,8 @@ class CacheAnalytics extends AnalyticsAbstract {
24 24
      */
25 25
     sendEvent(action, data = {}) {
26 26
         this.eventCache.push({
27
-            action: action,
28
-            data: data
27
+            action,
28
+            data
29 29
         });
30 30
     }
31 31
 

+ 2
- 2
modules/statistics/CallStats.js 查看文件

@@ -357,7 +357,7 @@ CallStats._reportEvent = function (event, eventData) {
357 357
     } else {
358 358
         CallStats.reportsQueue.push({
359 359
             type: reportType.EVENT,
360
-            data: {event: event, eventData: eventData}
360
+            data: {event, eventData}
361 361
         });
362 362
         CallStats._checkInitialize();
363 363
     }
@@ -422,7 +422,7 @@ CallStats._reportError = function (type, e, pc) {
422 422
     } else {
423 423
         CallStats.reportsQueue.push({
424 424
             type: reportType.ERROR,
425
-            data: { type: type, error: e, pc: pc}
425
+            data: { type, error: e, pc}
426 426
         });
427 427
         CallStats._checkInitialize();
428 428
     }

+ 2
- 2
modules/statistics/RTPStatsCollector.js 查看文件

@@ -427,7 +427,7 @@ StatsCollector.prototype.processStatsReport = function () {
427 427
                 );
428 428
             })) {
429 429
                 conferenceStatsTransport.push(
430
-                    {ip: ip, type: type, localip: localip});
430
+                    {ip, type, localip});
431 431
             }
432 432
             continue;
433 433
         }
@@ -487,7 +487,7 @@ StatsCollector.prototype.processStatsReport = function () {
487 487
         ssrcStats.setLoss({
488 488
             packetsTotal: packetsDiff + packetsLostDiff,
489 489
             packetsLost: packetsLostDiff,
490
-            isDownloadStream: isDownloadStream
490
+            isDownloadStream
491 491
         });
492 492
 
493 493
         var bytesReceivedNow = getNonNegativeStat(now, 'bytesReceived');

+ 1
- 1
modules/statistics/statistics.js 查看文件

@@ -439,7 +439,7 @@ Statistics.prototype.sendFeedback = function(overall, detailed) {
439 439
         this.callstats.sendFeedback(overall, detailed);
440 440
     }
441 441
     Statistics.analytics.sendEvent("feedback.rating",
442
-        {value: overall, detailed: detailed});
442
+        {value: overall, detailed});
443 443
 };
444 444
 
445 445
 Statistics.LOCAL_JID = require("../../service/statistics/constants").LOCAL_JID;

+ 1
- 1
modules/transcription/transcriberHolder.js 查看文件

@@ -8,7 +8,7 @@
8 8
 var transcriberHolder = {
9 9
     transcribers : [],
10 10
 
11
-    add : function(transcriber){
11
+    add(transcriber){
12 12
         transcriberHolder.transcribers.push(transcriber);
13 13
     }
14 14
 };

+ 1
- 1
modules/util/AuthUtil.js 查看文件

@@ -20,7 +20,7 @@ var AuthUtil = {
20 20
      * <tt>null</tt> if 'urlPattern' is not a string and the URL can not be
21 21
      * constructed.
22 22
      */
23
-    getTokenAuthUrl: function (urlPattern, roomName, roleUpgrade) {
23
+    getTokenAuthUrl (urlPattern, roomName, roleUpgrade) {
24 24
         var url = urlPattern;
25 25
         if (typeof url !== "string") {
26 26
             return null;

+ 3
- 3
modules/util/GlobalOnErrorHandler.js 查看文件

@@ -53,14 +53,14 @@ var GlobalOnErrorHandler = {
53 53
      * Adds new error handlers.
54 54
      * @param handler the new handler.
55 55
      */
56
-    addHandler: function (handler) {
56
+    addHandler (handler) {
57 57
         handlers.push(handler);
58 58
     },
59 59
     /**
60 60
      * Calls the global error handler if there is one.
61 61
      * @param error the error to pass to the error handler
62 62
      */
63
-    callErrorHandler: function (error) {
63
+    callErrorHandler (error) {
64 64
         var errHandler = window.onerror;
65 65
         if(!errHandler) {
66 66
             return;
@@ -71,7 +71,7 @@ var GlobalOnErrorHandler = {
71 71
      * Calls the global rejection handler if there is one.
72 72
      * @param error the error to pass to the rejection handler.
73 73
      */
74
-    callUnhandledRejectionHandler: function (error) {
74
+    callUnhandledRejectionHandler (error) {
75 75
         var errHandler = window.onunhandledrejection;
76 76
         if(!errHandler) {
77 77
             return;

+ 5
- 5
modules/util/RandomUtil.js 查看文件

@@ -52,23 +52,23 @@ var RandomUtil = {
52 52
      * Returns a random hex digit.
53 53
      * @returns {*}
54 54
      */
55
-    randomHexDigit: function() {
55
+    randomHexDigit() {
56 56
         return randomElement(HEX_DIGITS);
57 57
     },
58 58
     /**
59 59
      * Returns a random string of hex digits with length 'len'.
60 60
      * @param len the length.
61 61
      */
62
-    randomHexString: function (len) {
62
+    randomHexString (len) {
63 63
         var ret = '';
64 64
         while (len--) {
65 65
             ret += this.randomHexDigit();
66 66
         }
67 67
         return ret;
68 68
     },
69
-    randomElement: randomElement,
70
-    randomAlphanumStr: randomAlphanumStr,
71
-    randomInt: randomInt
69
+    randomElement,
70
+    randomAlphanumStr,
71
+    randomInt
72 72
 };
73 73
 
74 74
 module.exports = RandomUtil;

+ 1
- 1
modules/util/ScriptUtil.js 查看文件

@@ -21,7 +21,7 @@ var ScriptUtil = {
21 21
      * @param loadCallback on load callback function
22 22
      * @param errorCallback callback to be called on error loading the script
23 23
      */
24
-    loadScript: function (src, async, prepend, relativeURL,
24
+    loadScript (src, async, prepend, relativeURL,
25 25
                           loadCallback, errorCallback) {
26 26
         var d = document;
27 27
         var tagName = 'script';

+ 1
- 1
modules/util/UsernameGenerator.js 查看文件

@@ -437,5 +437,5 @@ function generateUsername () {
437 437
 }
438 438
 
439 439
 module.exports = {
440
-    generateUsername: generateUsername
440
+    generateUsername
441 441
 };

+ 1
- 1
modules/version/ComponentsVersions.js 查看文件

@@ -69,7 +69,7 @@ ComponentsVersions.prototype.processPresence =
69 69
                 log.push({
70 70
                     id: "component_version",
71 71
                     component: componentName,
72
-                    version: version});
72
+                    version});
73 73
             }
74 74
         }.bind(this));
75 75
 

+ 5
- 5
modules/xmpp/ChatRoom.js 查看文件

@@ -10,12 +10,12 @@ import XMPPEvents from "../../service/xmpp/XMPPEvents";
10 10
 const logger = getLogger(__filename);
11 11
 
12 12
 var parser = {
13
-    packet2JSON: function (packet, nodes) {
13
+    packet2JSON (packet, nodes) {
14 14
         var self = this;
15 15
         $(packet).children().each(function () {
16 16
             var tagName = $(this).prop("tagName");
17 17
             const node = {
18
-                tagName: tagName
18
+                tagName
19 19
             };
20 20
             node.attributes = {};
21 21
             $($(this)[0].attributes).each(function( index, attr ) {
@@ -30,7 +30,7 @@ var parser = {
30 30
             self.packet2JSON($(this), node.children);
31 31
         });
32 32
     },
33
-    json2packet: function (nodes, packet) {
33
+    json2packet (nodes, packet) {
34 34
         for(let i = 0; i < nodes.length; i++) {
35 35
             const node = nodes[i];
36 36
             if(!node || node === null){
@@ -139,7 +139,7 @@ export default class ChatRoom extends Listenable {
139 139
             return;
140 140
         }
141 141
 
142
-        var pres = $pres({to: to });
142
+        var pres = $pres({to });
143 143
 
144 144
         // xep-0045 defines: "including in the initial presence stanza an empty
145 145
         // <x/> element qualified by the 'http://jabber.org/protocol/muc' namespace"
@@ -877,7 +877,7 @@ export default class ChatRoom extends Listenable {
877 877
             {to: this.focusMucJid, type: 'set'})
878 878
             .c('mute', {
879 879
                 xmlns: 'http://jitsi.org/jitmeet/audio',
880
-                jid: jid
880
+                jid
881 881
             })
882 882
             .t(mute.toString())
883 883
             .up();

+ 2
- 2
modules/xmpp/RtxModifier.js 查看文件

@@ -162,8 +162,8 @@ export default class RtxModifier {
162 162
                 videoMLine,
163 163
                 {
164 164
                     id: ssrc,
165
-                    cname: cname,
166
-                    msid: msid
165
+                    cname,
166
+                    msid
167 167
                 },
168 168
                 correspondingRtxSsrc);
169 169
         }

+ 11
- 11
modules/xmpp/SDP.js 查看文件

@@ -50,8 +50,8 @@ SDP.prototype.getMediaSsrcMap = function() {
50 50
         tmp = SDPUtil.find_lines(self.media[mediaindex], 'a=ssrc:');
51 51
         var mid = SDPUtil.parse_mid(SDPUtil.find_line(self.media[mediaindex], 'a=mid:'));
52 52
         var media = {
53
-            mediaindex: mediaindex,
54
-            mid: mid,
53
+            mediaindex,
54
+            mid,
55 55
             ssrcs: {},
56 56
             ssrcGroups: []
57 57
         };
@@ -74,8 +74,8 @@ SDP.prototype.getMediaSsrcMap = function() {
74 74
             var ssrcs = line.substr(14 + semantics.length).split(' ');
75 75
             if (ssrcs.length) {
76 76
                 media.ssrcGroups.push({
77
-                    semantics: semantics,
78
-                    ssrcs: ssrcs
77
+                    semantics,
78
+                    ssrcs
79 79
                 });
80 80
             }
81 81
         });
@@ -160,7 +160,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
160 160
         for (i = 0; i < lines.length; i++) {
161 161
             tmp = lines[i].split(' ');
162 162
             var semantics = tmp.shift().substr(8);
163
-            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics:semantics});
163
+            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics});
164 164
             for (j = 0; j < tmp.length; j++) {
165 165
                 elem.c('content', {name: tmp[j]}).up();
166 166
             }
@@ -194,7 +194,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
194 194
                 {xmlns: 'urn:xmpp:jingle:apps:rtp:1',
195 195
                     media: mline.media });
196 196
             if (ssrc) {
197
-                elem.attrs({ssrc: ssrc});
197
+                elem.attrs({ssrc});
198 198
             }
199 199
             for (j = 0; j < mline.fmt.length; j++) {
200 200
                 rtpmap = SDPUtil.find_line(this.media[i], 'a=rtpmap:' + mline.fmt[j]);
@@ -222,7 +222,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
222 222
 
223 223
             if (ssrc) {
224 224
                 // new style mapping
225
-                elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
225
+                elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
226 226
                 // FIXME: group by ssrc and support multiple different ssrcs
227 227
                 var ssrclines = SDPUtil.find_lines(this.media[i], 'a=ssrc:');
228 228
                 if(ssrclines.length > 0) {
@@ -232,7 +232,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
232 232
                         if (linessrc != ssrc) {
233 233
                             elem.up();
234 234
                             ssrc = linessrc;
235
-                            elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
235
+                            elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
236 236
                         }
237 237
                         var kv = line.substr(idx + 1);
238 238
                         elem.c('parameter');
@@ -250,7 +250,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
250 250
                     });
251 251
                 } else {
252 252
                     elem.up();
253
-                    elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
253
+                    elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
254 254
                     elem.c('parameter');
255 255
                     elem.attrs({name: "cname", value:Math.random().toString(36).substring(7)});
256 256
                     elem.up();
@@ -285,9 +285,9 @@ SDP.prototype.toJingle = function (elem, thecreator) {
285 285
                     var semantics = line.substr(0, idx).substr(13);
286 286
                     var ssrcs = line.substr(14 + semantics.length).split(' ');
287 287
                     if (ssrcs.length) {
288
-                        elem.c('ssrc-group', { semantics: semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
288
+                        elem.c('ssrc-group', { semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
289 289
                         ssrcs.forEach(function(ssrc) {
290
-                            elem.c('source', { ssrc: ssrc })
290
+                            elem.c('source', { ssrc })
291 291
                                 .up();
292 292
                         });
293 293
                         elem.up();

+ 3
- 3
modules/xmpp/SDPDiffer.js 查看文件

@@ -134,8 +134,8 @@ SDPDiffer.prototype.toJingle = function(modify) {
134 134
                     var nv = kv.split(':', 2);
135 135
                     var name = nv[0];
136 136
                     var value = SDPUtil.filter_special_chars(nv[1]);
137
-                    modify.attrs({ name: name });
138
-                    modify.attrs({ value: value });
137
+                    modify.attrs({ name });
138
+                    modify.attrs({ value });
139 139
                 }
140 140
                 modify.up(); // end of parameter
141 141
             });
@@ -152,7 +152,7 @@ SDPDiffer.prototype.toJingle = function(modify) {
152 152
                 });
153 153
 
154 154
                 ssrcGroup.ssrcs.forEach(function (ssrc) {
155
-                    modify.c('source', { ssrc: ssrc })
155
+                    modify.c('source', { ssrc })
156 156
                         .up(); // end of source
157 157
                 });
158 158
                 modify.up(); // end of ssrc-group

+ 31
- 31
modules/xmpp/SDPUtil.js 查看文件

@@ -4,12 +4,12 @@ import RandomUtil from "../util/RandomUtil";
4 4
 var RTCBrowserType = require("../RTC/RTCBrowserType");
5 5
 
6 6
 var SDPUtil = {
7
-    filter_special_chars: function (text) {
7
+    filter_special_chars (text) {
8 8
         // XXX Neither one of the falsy values (e.g. null, undefined, false,
9 9
         // "", etc.) "contain" special chars.
10 10
         return text ? text.replace(/[\\\/\{,\}\+]/g, "") : text;
11 11
     },
12
-    iceparams: function (mediadesc, sessiondesc) {
12
+    iceparams (mediadesc, sessiondesc) {
13 13
         var data = null;
14 14
         var ufrag, pwd;
15 15
         if ((ufrag = SDPUtil.find_line(mediadesc, 'a=ice-ufrag:', sessiondesc))
@@ -21,22 +21,22 @@ var SDPUtil = {
21 21
         }
22 22
         return data;
23 23
     },
24
-    parse_iceufrag: function (line) {
24
+    parse_iceufrag (line) {
25 25
         return line.substring(12);
26 26
     },
27
-    build_iceufrag: function (frag) {
27
+    build_iceufrag (frag) {
28 28
         return 'a=ice-ufrag:' + frag;
29 29
     },
30
-    parse_icepwd: function (line) {
30
+    parse_icepwd (line) {
31 31
         return line.substring(10);
32 32
     },
33
-    build_icepwd: function (pwd) {
33
+    build_icepwd (pwd) {
34 34
         return 'a=ice-pwd:' + pwd;
35 35
     },
36
-    parse_mid: function (line) {
36
+    parse_mid (line) {
37 37
         return line.substring(6);
38 38
     },
39
-    parse_mline: function (line) {
39
+    parse_mline (line) {
40 40
         var parts = line.substring(2).split(' '),
41 41
             data = {};
42 42
         data.media = parts.shift();
@@ -48,10 +48,10 @@ var SDPUtil = {
48 48
         data.fmt = parts;
49 49
         return data;
50 50
     },
51
-    build_mline: function (mline) {
51
+    build_mline (mline) {
52 52
         return 'm=' + mline.media + ' ' + mline.port + ' ' + mline.proto + ' ' + mline.fmt.join(' ');
53 53
     },
54
-    parse_rtpmap: function (line) {
54
+    parse_rtpmap (line) {
55 55
         var parts = line.substring(9).split(' '),
56 56
             data = {};
57 57
         data.id = parts.shift();
@@ -66,7 +66,7 @@ var SDPUtil = {
66 66
      * @param line eg. "a=sctpmap:5000 webrtc-datachannel"
67 67
      * @returns [SCTP port number, protocol, streams]
68 68
      */
69
-    parse_sctpmap: function (line) {
69
+    parse_sctpmap (line) {
70 70
         var parts = line.substring(10).split(' ');
71 71
         var sctpPort = parts[0];
72 72
         var protocol = parts[1];
@@ -74,14 +74,14 @@ var SDPUtil = {
74 74
         var streamCount = parts.length > 2 ? parts[2] : null;
75 75
         return [sctpPort, protocol, streamCount];// SCTP port
76 76
     },
77
-    build_rtpmap: function (el) {
77
+    build_rtpmap (el) {
78 78
         var line = 'a=rtpmap:' + el.getAttribute('id') + ' ' + el.getAttribute('name') + '/' + el.getAttribute('clockrate');
79 79
         if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
80 80
             line += '/' + el.getAttribute('channels');
81 81
         }
82 82
         return line;
83 83
     },
84
-    parse_crypto: function (line) {
84
+    parse_crypto (line) {
85 85
         var parts = line.substring(9).split(' '),
86 86
             data = {};
87 87
         data.tag = parts.shift();
@@ -92,7 +92,7 @@ var SDPUtil = {
92 92
         }
93 93
         return data;
94 94
     },
95
-    parse_fingerprint: function (line) { // RFC 4572
95
+    parse_fingerprint (line) { // RFC 4572
96 96
         var parts = line.substring(14).split(' '),
97 97
             data = {};
98 98
         data.hash = parts.shift();
@@ -100,7 +100,7 @@ var SDPUtil = {
100 100
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
101 101
         return data;
102 102
     },
103
-    parse_fmtp: function (line) {
103
+    parse_fmtp (line) {
104 104
         var parts = line.split(' '),
105 105
             i, key, value,
106 106
             data = [];
@@ -113,7 +113,7 @@ var SDPUtil = {
113 113
             }
114 114
             value = parts[i].split('=')[1];
115 115
             if (key && value) {
116
-                data.push({name: key, value: value});
116
+                data.push({name: key, value});
117 117
             } else if (key) {
118 118
                 // rfc 4733 (DTMF) style stuff
119 119
                 data.push({name: '', value: key});
@@ -121,7 +121,7 @@ var SDPUtil = {
121 121
         }
122 122
         return data;
123 123
     },
124
-    parse_icecandidate: function (line) {
124
+    parse_icecandidate (line) {
125 125
         var candidate = {},
126 126
             elems = line.split(' ');
127 127
         candidate.foundation = elems[0].substring(12);
@@ -155,7 +155,7 @@ var SDPUtil = {
155 155
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
156 156
         return candidate;
157 157
     },
158
-    build_icecandidate: function (cand) {
158
+    build_icecandidate (cand) {
159 159
         var line = ['a=candidate:' + cand.foundation, cand.component, cand.protocol, cand.priority, cand.ip, cand.port, 'typ', cand.type].join(' ');
160 160
         line += ' ';
161 161
         switch (cand.type) {
@@ -185,7 +185,7 @@ var SDPUtil = {
185 185
         line += cand.hasOwnAttribute('generation') ? cand.generation : '0';
186 186
         return line;
187 187
     },
188
-    parse_ssrc: function (desc) {
188
+    parse_ssrc (desc) {
189 189
         // proprietary mapping of a=ssrc lines
190 190
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
191 191
         // and parse according to that
@@ -199,7 +199,7 @@ var SDPUtil = {
199 199
         }
200 200
         return data;
201 201
     },
202
-    parse_rtcpfb: function (line) {
202
+    parse_rtcpfb (line) {
203 203
         var parts = line.substr(10).split(' ');
204 204
         var data = {};
205 205
         data.pt = parts.shift();
@@ -207,7 +207,7 @@ var SDPUtil = {
207 207
         data.params = parts;
208 208
         return data;
209 209
     },
210
-    parse_extmap: function (line) {
210
+    parse_extmap (line) {
211 211
         var parts = line.substr(9).split(' ');
212 212
         var data = {};
213 213
         data.value = parts.shift();
@@ -221,7 +221,7 @@ var SDPUtil = {
221 221
         data.params = parts;
222 222
         return data;
223 223
     },
224
-    find_line: function (haystack, needle, sessionpart) {
224
+    find_line (haystack, needle, sessionpart) {
225 225
         var lines = haystack.split('\r\n');
226 226
         for (var i = 0; i < lines.length; i++) {
227 227
             if (lines[i].substring(0, needle.length) == needle) {
@@ -240,7 +240,7 @@ var SDPUtil = {
240 240
         }
241 241
         return false;
242 242
     },
243
-    find_lines: function (haystack, needle, sessionpart) {
243
+    find_lines (haystack, needle, sessionpart) {
244 244
         var lines = haystack.split('\r\n'),
245 245
             needles = [];
246 246
         for (var i = 0; i < lines.length; i++) {
@@ -260,7 +260,7 @@ var SDPUtil = {
260 260
         }
261 261
         return needles;
262 262
     },
263
-    candidateToJingle: function (line) {
263
+    candidateToJingle (line) {
264 264
         // a=candidate:2979166662 1 udp 2113937151 192.168.2.100 57698 typ host generation 0
265 265
         //      <candidate component=... foundation=... generation=... id=... ip=... network=... port=... priority=... protocol=... type=.../>
266 266
         if (line.indexOf('candidate:') === 0) {
@@ -313,7 +313,7 @@ var SDPUtil = {
313 313
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
314 314
         return candidate;
315 315
     },
316
-    candidateFromJingle: function (cand) {
316
+    candidateFromJingle (cand) {
317 317
         var line = 'a=candidate:';
318 318
         line += cand.getAttribute('foundation');
319 319
         line += ' ';
@@ -370,7 +370,7 @@ var SDPUtil = {
370 370
      * @param {object} mLine object as parsed from transform.parse
371 371
      * @return {number} the primary video ssrc from the given m line
372 372
      */
373
-    parsePrimaryVideoSsrc: function(videoMLine) {
373
+    parsePrimaryVideoSsrc(videoMLine) {
374 374
         const numSsrcs = videoMLine.ssrcs
375 375
             .map(ssrcInfo => ssrcInfo.id)
376 376
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
@@ -407,7 +407,7 @@ var SDPUtil = {
407 407
      * Generate an ssrc
408 408
      * @returns {number} an ssrc
409 409
      */
410
-    generateSsrc: function() {
410
+    generateSsrc() {
411 411
         return RandomUtil.randomInt(1, 0xffffffff);
412 412
     },
413 413
 
@@ -420,7 +420,7 @@ var SDPUtil = {
420 420
      * @returns {string} the value corresponding to the given ssrc
421 421
      *  and attributeName
422 422
      */
423
-    getSsrcAttribute: function (mLine, ssrc, attributeName) {
423
+    getSsrcAttribute (mLine, ssrc, attributeName) {
424 424
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
425 425
             const ssrcLine = mLine.ssrcs[i];
426 426
             if (ssrcLine.id === ssrc &&
@@ -438,7 +438,7 @@ var SDPUtil = {
438 438
      * @returns {list<number>} a list of the ssrcs in the group
439 439
      *  parsed as numbers
440 440
      */
441
-    parseGroupSsrcs: function (ssrcGroup) {
441
+    parseGroupSsrcs (ssrcGroup) {
442 442
         return ssrcGroup
443 443
             .ssrcs
444 444
             .split(" ")
@@ -451,7 +451,7 @@ var SDPUtil = {
451 451
      * @param {string} type the type of the desired mline (e.g. "video")
452 452
      * @returns {object} a media object
453 453
      */
454
-    getMedia: function (sdp, type) {
454
+    getMedia (sdp, type) {
455 455
         return sdp.media.find(m => m.type === type);
456 456
     },
457 457
     /**
@@ -465,7 +465,7 @@ var SDPUtil = {
465 465
      *  an sdp as parsed by transform.parse
466 466
      * @param {string} the name of the preferred codec
467 467
      */
468
-    preferVideoCodec: function(videoMLine, codecName) {
468
+    preferVideoCodec(videoMLine, codecName) {
469 469
         let payloadType = null;
470 470
         for (let i = 0; i < videoMLine.rtp.length; ++i) {
471 471
             const rtp = videoMLine.rtp[i];

+ 1
- 1
modules/xmpp/recording.js 查看文件

@@ -166,7 +166,7 @@ function (state, callback, errCallback, options) {
166 166
     elem.c('conference', {
167 167
         xmlns: 'http://jitsi.org/protocol/colibri'
168 168
     });
169
-    elem.c('recording', {state: state, token: options.token});
169
+    elem.c('recording', {state, token: options.token});
170 170
 
171 171
     var self = this;
172 172
     this.connection.sendIQ(elem,

+ 2
- 2
modules/xmpp/strophe.rayo.js 查看文件

@@ -30,8 +30,8 @@ class RayoConnectionPlugin extends ConnectionPlugin {
30 30
             });
31 31
             req.c('dial', {
32 32
                 xmlns: RAYO_XMLNS,
33
-                to: to,
34
-                from: from
33
+                to,
34
+                from
35 35
             });
36 36
             req.c('header', {
37 37
                 name: 'JvbRoomName',

+ 2
- 2
modules/xmpp/xmpp.js 查看文件

@@ -246,8 +246,8 @@ export default class XMPP extends Listenable {
246 246
 
247 247
     connect (jid, password) {
248 248
         this.connectParams = {
249
-            jid: jid,
250
-            password: password
249
+            jid,
250
+            password
251 251
         };
252 252
         if (!jid) {
253 253
             let configDomain

+ 1
- 1
webpack.config.js 查看文件

@@ -82,5 +82,5 @@ module.exports = {
82 82
         libraryTarget: 'umd',
83 83
         sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
84 84
     },
85
-    plugins: plugins
85
+    plugins
86 86
 };

Loading…
取消
儲存