Bladeren bron

[eslint] object-shorthand

master
Lyubo Marinov 8 jaren geleden
bovenliggende
commit
596767d57e

+ 5
- 0
.eslintrc.js Bestand weergeven

@@ -52,6 +52,11 @@ module.exports = {
52 52
             { 'nestedBinaryExpressions': false }
53 53
         ],
54 54
 
55
+        'object-shorthand': [
56
+            'error',
57
+            'always',
58
+            { 'avoidQuotes': true }
59
+        ],
55 60
         'prefer-const': 2,
56 61
         'prefer-reflect': 0,
57 62
         'prefer-spread': 2,

+ 1
- 1
JitsiConference.js Bestand weergeven

@@ -1387,7 +1387,7 @@ JitsiConference.prototype.getConnectionTimes = function () {
1387 1387
  * Sets a property for the local participant.
1388 1388
  */
1389 1389
 JitsiConference.prototype.setLocalParticipantProperty = function(name, value) {
1390
-    this.sendCommand("jitsi_participant_" + name, {value: value});
1390
+    this.sendCommand("jitsi_participant_" + name, {value});
1391 1391
 };
1392 1392
 
1393 1393
 /**

+ 3
- 3
JitsiConferenceEventManager.js Bestand weergeven

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

+ 2
- 2
JitsiConnection.js Bestand weergeven

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

+ 9
- 9
JitsiMediaDevices.js Bestand weergeven

@@ -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)
@@ -115,7 +115,7 @@ var JitsiMediaDevices = {
115 115
      * @param {string} event - event name
116 116
      * @param {function} handler - event handler
117 117
      */
118
-    addEventListener: function (event, handler) {
118
+    addEventListener (event, handler) {
119 119
         eventEmitter.addListener(event, handler);
120 120
     },
121 121
     /**
@@ -123,14 +123,14 @@ var JitsiMediaDevices = {
123 123
      * @param {string} event - event name
124 124
      * @param {function} handler - event handler
125 125
      */
126
-    removeEventListener: function (event, handler) {
126
+    removeEventListener (event, handler) {
127 127
         eventEmitter.removeListener(event, handler);
128 128
     },
129 129
     /**
130 130
      * Emits an event.
131 131
      * @param {string} event - event name
132 132
      */
133
-    emitEvent: function (event) { // eslint-disable-line no-unused-vars
133
+    emitEvent (event) { // eslint-disable-line no-unused-vars
134 134
         eventEmitter.emit(...arguments);
135 135
     }
136 136
 };

+ 17
- 17
JitsiMeetJS.js Bestand weergeven

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

+ 1
- 1
modules/RTC/DataChannels.js Bestand weergeven

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

+ 4
- 4
modules/RTC/RTCUIHelper.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -177,7 +177,7 @@ function getConstraints(um, options) {
177 177
                 constraints.video.facingMode = facingMode;
178 178
             }
179 179
             constraints.video.optional.push({
180
-                facingMode: facingMode
180
+                facingMode
181 181
             });
182 182
         }
183 183
 
@@ -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;
@@ -1109,7 +1109,7 @@ class RTCUtils extends Listenable {
1109 1109
                                     dsOptions,
1110 1110
                                     function (desktopStream) {
1111 1111
                                         successCallback({audioVideo: stream,
1112
-                                            desktopStream: desktopStream});
1112
+                                            desktopStream});
1113 1113
                                     }, function (error) {
1114 1114
                                         self.stopMediaStream(stream);
1115 1115
 

+ 4
- 4
modules/RTC/TraceablePeerConnection.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -423,7 +423,7 @@ StatsCollector.prototype.processStatsReport = function () {
423 423
                         t.ip == ip && t.type == type && t.localip == localip
424 424
                     );})) {
425 425
                 conferenceStatsTransport.push(
426
-                    {ip: ip, type: type, localip: localip});
426
+                    {ip, type, localip});
427 427
             }
428 428
             continue;
429 429
         }
@@ -481,7 +481,7 @@ StatsCollector.prototype.processStatsReport = function () {
481 481
         ssrcStats.setLoss({
482 482
             packetsTotal: packetsDiff + packetsLostDiff,
483 483
             packetsLost: packetsLostDiff,
484
-            isDownloadStream: isDownloadStream
484
+            isDownloadStream
485 485
         });
486 486
 
487 487
         var bytesReceivedNow = getNonNegativeStat(now, 'bytesReceived');

+ 1
- 1
modules/statistics/statistics.js Bestand weergeven

@@ -421,7 +421,7 @@ Statistics.prototype.sendFeedback = function(overall, detailed) {
421 421
     if(this.callstats)
422 422
         this.callstats.sendFeedback(overall, detailed);
423 423
     Statistics.analytics.sendEvent("feedback.rating",
424
-        {value: overall, detailed: detailed});
424
+        {value: overall, detailed});
425 425
 };
426 426
 
427 427
 Statistics.LOCAL_JID = require("../../service/statistics/constants").LOCAL_JID;

+ 1
- 1
modules/transcription/transcriberHolder.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

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

+ 5
- 5
modules/util/RandomUtil.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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 Bestand weergeven

@@ -425,5 +425,5 @@ function generateUsername () {
425 425
 }
426 426
 
427 427
 module.exports = {
428
-  generateUsername: generateUsername
428
+  generateUsername
429 429
 };

+ 1
- 1
modules/version/ComponentsVersions.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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){
@@ -135,7 +135,7 @@ export default class ChatRoom extends Listenable {
135 135
             return;
136 136
         }
137 137
 
138
-        var pres = $pres({to: to });
138
+        var pres = $pres({to });
139 139
 
140 140
         // xep-0045 defines: "including in the initial presence stanza an empty
141 141
         // <x/> element qualified by the 'http://jabber.org/protocol/muc' namespace"
@@ -864,7 +864,7 @@ export default class ChatRoom extends Listenable {
864 864
             {to: this.focusMucJid, type: 'set'})
865 865
             .c('mute', {
866 866
                 xmlns: 'http://jitsi.org/jitmeet/audio',
867
-                jid: jid
867
+                jid
868 868
             })
869 869
             .t(mute.toString())
870 870
             .up();

+ 2
- 2
modules/xmpp/RtxModifier.js Bestand weergeven

@@ -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 Bestand weergeven

@@ -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
         });
@@ -157,7 +157,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
157 157
         for (i = 0; i < lines.length; i++) {
158 158
             tmp = lines[i].split(' ');
159 159
             var semantics = tmp.shift().substr(8);
160
-            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics:semantics});
160
+            elem.c('group', {xmlns: 'urn:xmpp:jingle:apps:grouping:0', semantics});
161 161
             for (j = 0; j < tmp.length; j++) {
162 162
                 elem.c('content', {name: tmp[j]}).up();
163 163
             }
@@ -191,7 +191,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
191 191
                 {xmlns: 'urn:xmpp:jingle:apps:rtp:1',
192 192
                     media: mline.media });
193 193
             if (ssrc) {
194
-                elem.attrs({ssrc: ssrc});
194
+                elem.attrs({ssrc});
195 195
             }
196 196
             for (j = 0; j < mline.fmt.length; j++) {
197 197
                 rtpmap = SDPUtil.find_line(this.media[i], 'a=rtpmap:' + mline.fmt[j]);
@@ -219,7 +219,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
219 219
 
220 220
             if (ssrc) {
221 221
                 // new style mapping
222
-                elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
222
+                elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
223 223
                 // FIXME: group by ssrc and support multiple different ssrcs
224 224
                 var ssrclines = SDPUtil.find_lines(this.media[i], 'a=ssrc:');
225 225
                 if(ssrclines.length > 0) {
@@ -229,7 +229,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
229 229
                         if (linessrc != ssrc) {
230 230
                             elem.up();
231 231
                             ssrc = linessrc;
232
-                            elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
232
+                            elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
233 233
                         }
234 234
                         var kv = line.substr(idx + 1);
235 235
                         elem.c('parameter');
@@ -247,7 +247,7 @@ SDP.prototype.toJingle = function (elem, thecreator) {
247 247
                     });
248 248
                 } else {
249 249
                     elem.up();
250
-                    elem.c('source', { ssrc: ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
250
+                    elem.c('source', { ssrc, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
251 251
                     elem.c('parameter');
252 252
                     elem.attrs({name: "cname", value:Math.random().toString(36).substring(7)});
253 253
                     elem.up();
@@ -282,9 +282,9 @@ SDP.prototype.toJingle = function (elem, thecreator) {
282 282
                     var semantics = line.substr(0, idx).substr(13);
283 283
                     var ssrcs = line.substr(14 + semantics.length).split(' ');
284 284
                     if (ssrcs.length) {
285
-                        elem.c('ssrc-group', { semantics: semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
285
+                        elem.c('ssrc-group', { semantics, xmlns: 'urn:xmpp:jingle:apps:rtp:ssma:0' });
286 286
                         ssrcs.forEach(function(ssrc) {
287
-                            elem.c('source', { ssrc: ssrc })
287
+                            elem.c('source', { ssrc })
288 288
                                 .up();
289 289
                         });
290 290
                         elem.up();

+ 3
- 3
modules/xmpp/SDPDiffer.js Bestand weergeven

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

+ 31
- 31
modules/xmpp/SDPUtil.js Bestand weergeven

@@ -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
     {
71 71
         var parts = line.substring(10).split(' ');
72 72
         var sctpPort = parts[0];
@@ -75,14 +75,14 @@ var SDPUtil = {
75 75
         var streamCount = parts.length > 2 ? parts[2] : null;
76 76
         return [sctpPort, protocol, streamCount];// SCTP port
77 77
     },
78
-    build_rtpmap: function (el) {
78
+    build_rtpmap (el) {
79 79
         var line = 'a=rtpmap:' + el.getAttribute('id') + ' ' + el.getAttribute('name') + '/' + el.getAttribute('clockrate');
80 80
         if (el.getAttribute('channels') && el.getAttribute('channels') != '1') {
81 81
             line += '/' + el.getAttribute('channels');
82 82
         }
83 83
         return line;
84 84
     },
85
-    parse_crypto: function (line) {
85
+    parse_crypto (line) {
86 86
         var parts = line.substring(9).split(' '),
87 87
             data = {};
88 88
         data.tag = parts.shift();
@@ -93,7 +93,7 @@ var SDPUtil = {
93 93
         }
94 94
         return data;
95 95
     },
96
-    parse_fingerprint: function (line) { // RFC 4572
96
+    parse_fingerprint (line) { // RFC 4572
97 97
         var parts = line.substring(14).split(' '),
98 98
             data = {};
99 99
         data.hash = parts.shift();
@@ -101,7 +101,7 @@ var SDPUtil = {
101 101
         // TODO assert that fingerprint satisfies 2UHEX *(":" 2UHEX) ?
102 102
         return data;
103 103
     },
104
-    parse_fmtp: function (line) {
104
+    parse_fmtp (line) {
105 105
         var parts = line.split(' '),
106 106
             i, key, value,
107 107
             data = [];
@@ -114,7 +114,7 @@ var SDPUtil = {
114 114
             }
115 115
             value = parts[i].split('=')[1];
116 116
             if (key && value) {
117
-                data.push({name: key, value: value});
117
+                data.push({name: key, value});
118 118
             } else if (key) {
119 119
                 // rfc 4733 (DTMF) style stuff
120 120
                 data.push({name: '', value: key});
@@ -122,7 +122,7 @@ var SDPUtil = {
122 122
         }
123 123
         return data;
124 124
     },
125
-    parse_icecandidate: function (line) {
125
+    parse_icecandidate (line) {
126 126
         var candidate = {},
127 127
             elems = line.split(' ');
128 128
         candidate.foundation = elems[0].substring(12);
@@ -156,7 +156,7 @@ var SDPUtil = {
156 156
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
157 157
         return candidate;
158 158
     },
159
-    build_icecandidate: function (cand) {
159
+    build_icecandidate (cand) {
160 160
         var line = ['a=candidate:' + cand.foundation, cand.component, cand.protocol, cand.priority, cand.ip, cand.port, 'typ', cand.type].join(' ');
161 161
         line += ' ';
162 162
         switch (cand.type) {
@@ -186,7 +186,7 @@ var SDPUtil = {
186 186
         line += cand.hasOwnAttribute('generation') ? cand.generation : '0';
187 187
         return line;
188 188
     },
189
-    parse_ssrc: function (desc) {
189
+    parse_ssrc (desc) {
190 190
         // proprietary mapping of a=ssrc lines
191 191
         // TODO: see "Jingle RTP Source Description" by Juberti and P. Thatcher on google docs
192 192
         // and parse according to that
@@ -200,7 +200,7 @@ var SDPUtil = {
200 200
         }
201 201
         return data;
202 202
     },
203
-    parse_rtcpfb: function (line) {
203
+    parse_rtcpfb (line) {
204 204
         var parts = line.substr(10).split(' ');
205 205
         var data = {};
206 206
         data.pt = parts.shift();
@@ -208,7 +208,7 @@ var SDPUtil = {
208 208
         data.params = parts;
209 209
         return data;
210 210
     },
211
-    parse_extmap: function (line) {
211
+    parse_extmap (line) {
212 212
         var parts = line.substr(9).split(' ');
213 213
         var data = {};
214 214
         data.value = parts.shift();
@@ -222,7 +222,7 @@ var SDPUtil = {
222 222
         data.params = parts;
223 223
         return data;
224 224
     },
225
-    find_line: function (haystack, needle, sessionpart) {
225
+    find_line (haystack, needle, sessionpart) {
226 226
         var lines = haystack.split('\r\n');
227 227
         for (var i = 0; i < lines.length; i++) {
228 228
             if (lines[i].substring(0, needle.length) == needle) {
@@ -241,7 +241,7 @@ var SDPUtil = {
241 241
         }
242 242
         return false;
243 243
     },
244
-    find_lines: function (haystack, needle, sessionpart) {
244
+    find_lines (haystack, needle, sessionpart) {
245 245
         var lines = haystack.split('\r\n'),
246 246
             needles = [];
247 247
         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) {
@@ -312,7 +312,7 @@ var SDPUtil = {
312 312
         candidate.id = Math.random().toString(36).substr(2, 10); // not applicable to SDP -- FIXME: should be unique, not just random
313 313
         return candidate;
314 314
     },
315
-    candidateFromJingle: function (cand) {
315
+    candidateFromJingle (cand) {
316 316
         var line = 'a=candidate:';
317 317
         line += cand.getAttribute('foundation');
318 318
         line += ' ';
@@ -369,7 +369,7 @@ var SDPUtil = {
369 369
      * @param {object} mLine object as parsed from transform.parse
370 370
      * @return {number} the primary video ssrc from the given m line
371 371
      */
372
-    parsePrimaryVideoSsrc: function(videoMLine) {
372
+    parsePrimaryVideoSsrc(videoMLine) {
373 373
         const numSsrcs = videoMLine.ssrcs
374 374
             .map(ssrcInfo => ssrcInfo.id)
375 375
             .filter((ssrc, index, array) => array.indexOf(ssrc) === index)
@@ -406,7 +406,7 @@ var SDPUtil = {
406 406
      * Generate an ssrc
407 407
      * @returns {number} an ssrc
408 408
      */
409
-    generateSsrc: function() {
409
+    generateSsrc() {
410 410
         return RandomUtil.randomInt(1, 0xffffffff);
411 411
     },
412 412
 
@@ -419,7 +419,7 @@ var SDPUtil = {
419 419
      * @returns {string} the value corresponding to the given ssrc
420 420
      *  and attributeName
421 421
      */
422
-    getSsrcAttribute: function (mLine, ssrc, attributeName) {
422
+    getSsrcAttribute (mLine, ssrc, attributeName) {
423 423
         for (let i = 0; i < mLine.ssrcs.length; ++i) {
424 424
             const ssrcLine = mLine.ssrcs[i];
425 425
             if (ssrcLine.id === ssrc &&
@@ -437,7 +437,7 @@ var SDPUtil = {
437 437
      * @returns {list<number>} a list of the ssrcs in the group
438 438
      *  parsed as numbers
439 439
      */
440
-    parseGroupSsrcs: function (ssrcGroup) {
440
+    parseGroupSsrcs (ssrcGroup) {
441 441
         return ssrcGroup
442 442
             .ssrcs
443 443
             .split(" ")
@@ -450,7 +450,7 @@ var SDPUtil = {
450 450
      * @param {string} type the type of the desired mline (e.g. "video")
451 451
      * @returns {object} a media object
452 452
      */
453
-    getMedia: function (sdp, type) {
453
+    getMedia (sdp, type) {
454 454
         return sdp.media.find(m => m.type === type);
455 455
     },
456 456
     /**
@@ -464,7 +464,7 @@ var SDPUtil = {
464 464
      *  an sdp as parsed by transform.parse
465 465
      * @param {string} the name of the preferred codec
466 466
      */
467
-    preferVideoCodec: function(videoMLine, codecName) {
467
+    preferVideoCodec(videoMLine, codecName) {
468 468
         let payloadType = null;
469 469
         for (let i = 0; i < videoMLine.rtp.length; ++i) {
470 470
           const rtp = videoMLine.rtp[i];

+ 1
- 1
modules/xmpp/recording.js Bestand weergeven

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

+ 2
- 2
modules/xmpp/strophe.rayo.js Bestand weergeven

@@ -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 Bestand weergeven

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

+ 1
- 1
webpack.config.js Bestand weergeven

@@ -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
 };

Laden…
Annuleren
Opslaan