Pārlūkot izejas kodu

Built after linter pr

ericz 10 gadi atpakaļ
vecāks
revīzija
9ed9aa8a57
2 mainītis faili ar 39 papildinājumiem un 39 dzēšanām
  1. 39 39
      dist/peer.js
  2. 0 0
      dist/peer.min.js

+ 39 - 39
dist/peer.js

@@ -788,7 +788,7 @@ function Peer(id, options) {
     this._retrieveId();
   }
   //
-};
+}
 
 util.inherits(Peer, EventEmitter);
 
@@ -806,7 +806,7 @@ Peer.prototype._initializeServerConnection = function() {
   this.socket.on('disconnected', function() {
     // If we haven't explicitly disconnected, emit error and disconnect.
     if (!self.disconnected) {
-      self.emitError('network', 'Lost connection to server.')
+      self.emitError('network', 'Lost connection to server.');
       self.disconnect();
     }
   });
@@ -823,8 +823,8 @@ Peer.prototype._retrieveId = function(cb) {
   var self = this;
   var http = new XMLHttpRequest();
   var protocol = this.options.secure ? 'https://' : 'http://';
-  var url = protocol + this.options.host + ':' + this.options.port
-    + this.options.path + this.options.key + '/id';
+  var url = protocol + this.options.host + ':' + this.options.port +
+    this.options.path + this.options.key + '/id';
   var queryString = '?ts=' + new Date().getTime() + '' + Math.random();
   url += queryString;
 
@@ -834,12 +834,12 @@ Peer.prototype._retrieveId = function(cb) {
     util.error('Error retrieving ID', e);
     var pathError = '';
     if (self.options.path === '/' && self.options.host !== util.CLOUD_HOST) {
-      pathError = ' If you passed in a `path` to your self-hosted PeerServer, '
-        + 'you\'ll also need to pass in that same path when creating a new'
-        + ' Peer.';
+      pathError = ' If you passed in a `path` to your self-hosted PeerServer, ' +
+        'you\'ll also need to pass in that same path when creating a new ' +
+        'Peer.';
     }
     self._abort('server-error', 'Could not get an ID from the server.' + pathError);
-  }
+  };
   http.onreadystatechange = function() {
     if (http.readyState !== 4) {
       return;
@@ -857,7 +857,7 @@ Peer.prototype._retrieveId = function(cb) {
 Peer.prototype._initialize = function(id) {
   this.id = id;
   this.socket.start(this.id, this.options.token);
-}
+};
 
 /** Handles messages from the server. */
 Peer.prototype._handleMessage = function(message) {
@@ -899,7 +899,7 @@ Peer.prototype._handleMessage = function(message) {
       } else {
         // Create a new connection.
         if (payload.type === 'media') {
-          var connection = new MediaConnection(peer, this, {
+          connection = new MediaConnection(peer, this, {
             connectionId: connectionId,
             _payload: payload,
             metadata: payload.metadata
@@ -935,7 +935,7 @@ Peer.prototype._handleMessage = function(message) {
       }
 
       var id = payload.connectionId;
-      var connection = this.getConnection(peer, id);
+      connection = this.getConnection(peer, id);
 
       if (connection && connection.pc) {
         // Pass it on.
@@ -948,7 +948,7 @@ Peer.prototype._handleMessage = function(message) {
       }
       break;
   }
-}
+};
 
 /** Stores messages without a set up connection, to be claimed later. */
 Peer.prototype._storeMessage = function(connectionId, message) {
@@ -956,7 +956,7 @@ Peer.prototype._storeMessage = function(connectionId, message) {
     this._lostMessages[connectionId] = [];
   }
   this._lostMessages[connectionId].push(message);
-}
+};
 
 /** Retrieve messages from lost message store */
 Peer.prototype._getMessages = function(connectionId) {
@@ -967,7 +967,7 @@ Peer.prototype._getMessages = function(connectionId) {
   } else {
     return [];
   }
-}
+};
 
 /**
  * Returns a DataConnection to the specified peer. See documentation for a
@@ -975,17 +975,17 @@ Peer.prototype._getMessages = function(connectionId) {
  */
 Peer.prototype.connect = function(peer, options) {
   if (this.disconnected) {
-    util.warn('You cannot connect to a new Peer because you called '
-        + '.disconnect() on this Peer and ended your connection with the'
-        + ' server. You can create a new Peer to reconnect, or call reconnect'
-        + ' on this peer if you believe its ID to still be available.');
+    util.warn('You cannot connect to a new Peer because you called ' +
+      '.disconnect() on this Peer and ended your connection with the ' +
+      'server. You can create a new Peer to reconnect, or call reconnect ' +
+      'on this peer if you believe its ID to still be available.');
     this.emitError('disconnected', 'Cannot connect to new Peer after disconnecting from server.');
     return;
   }
   var connection = new DataConnection(peer, this, options);
   this._addConnection(peer, connection);
   return connection;
-}
+};
 
 /**
  * Returns a MediaConnection to the specified peer. See documentation for a
@@ -993,9 +993,9 @@ Peer.prototype.connect = function(peer, options) {
  */
 Peer.prototype.call = function(peer, stream, options) {
   if (this.disconnected) {
-    util.warn('You cannot connect to a new Peer because you called '
-        + '.disconnect() on this Peer and ended your connection with the'
-        + ' server. You can create a new Peer to reconnect.');
+    util.warn('You cannot connect to a new Peer because you called ' +
+      '.disconnect() on this Peer and ended your connection with the ' +
+      'server. You can create a new Peer to reconnect.');
     this.emitError('disconnected', 'Cannot connect to new Peer after disconnecting from server.');
     return;
   }
@@ -1008,7 +1008,7 @@ Peer.prototype.call = function(peer, stream, options) {
   var call = new MediaConnection(peer, this, options);
   this._addConnection(peer, call);
   return call;
-}
+};
 
 /** Add a data/media connection to this peer. */
 Peer.prototype._addConnection = function(peer, connection) {
@@ -1016,7 +1016,7 @@ Peer.prototype._addConnection = function(peer, connection) {
     this.connections[peer] = [];
   }
   this.connections[peer].push(connection);
-}
+};
 
 /** Retrieve a data/media connection for this peer. */
 Peer.prototype.getConnection = function(peer, id) {
@@ -1030,14 +1030,14 @@ Peer.prototype.getConnection = function(peer, id) {
     }
   }
   return null;
-}
+};
 
 Peer.prototype._delayedAbort = function(type, message) {
   var self = this;
   util.setZeroTimeout(function(){
     self._abort(type, message);
   });
-}
+};
 
 /**
  * Destroys the Peer and emits an error message.
@@ -1076,7 +1076,7 @@ Peer.prototype.destroy = function() {
     this.disconnect();
     this.destroyed = true;
   }
-}
+};
 
 
 /** Disconnects every connection on this peer. */
@@ -1088,7 +1088,7 @@ Peer.prototype._cleanup = function() {
     }
   }
   this.emit('close');
-}
+};
 
 /** Closes all connections to this peer. */
 Peer.prototype._cleanupPeer = function(peer) {
@@ -1096,7 +1096,7 @@ Peer.prototype._cleanupPeer = function(peer) {
   for (var j = 0, jj = connections.length; j < jj; j += 1) {
     connections[j].close();
   }
-}
+};
 
 /**
  * Disconnects the Peer's connection to the PeerServer. Does not close any
@@ -1118,7 +1118,7 @@ Peer.prototype.disconnect = function() {
       self.id = null;
     }
   });
-}
+};
 
 /** Attempts to reconnect with the same ID. */
 Peer.prototype.reconnect = function() {
@@ -1148,8 +1148,8 @@ Peer.prototype.listAllPeers = function(cb) {
   var self = this;
   var http = new XMLHttpRequest();
   var protocol = this.options.secure ? 'https://' : 'http://';
-  var url = protocol + this.options.host + ':' + this.options.port
-    + this.options.path + this.options.key + '/peers';
+  var url = protocol + this.options.host + ':' + this.options.port +
+    this.options.path + this.options.key + '/peers';
   var queryString = '?ts=' + new Date().getTime() + '' + Math.random();
   url += queryString;
 
@@ -1158,7 +1158,7 @@ Peer.prototype.listAllPeers = function(cb) {
   http.onerror = function(e) {
     self._abort('server-error', 'Could not get peers from the server.');
     cb([]);
-  }
+  };
   http.onreadystatechange = function() {
     if (http.readyState !== 4) {
       return;
@@ -1166,14 +1166,14 @@ Peer.prototype.listAllPeers = function(cb) {
     if (http.status === 401) {
       var helpfulError = '';
       if (self.options.host !== util.CLOUD_HOST) {
-        helpfulError = 'It looks like you\'re using the cloud server. You can email '
-          + 'team@peerjs.com to enable peer listing for your API key.';
+        helpfulError = 'It looks like you\'re using the cloud server. You can email ' +
+          'team@peerjs.com to enable peer listing for your API key.';
       } else {
-        helpfulError = 'You need to enable `allow_discovery` on your self-hosted'
-          + ' PeerServer to use this feature.';
+        helpfulError = 'You need to enable `allow_discovery` on your self-hosted ' +
+          'PeerServer to use this feature.';
       }
-      throw new Error('It doesn\'t look like you have permission to list peers IDs. ' + helpfulError);
       cb([]);
+      throw new Error('It doesn\'t look like you have permission to list peers IDs. ' + helpfulError);
     } else if (http.status !== 200) {
       cb([]);
     } else {
@@ -1181,7 +1181,7 @@ Peer.prototype.listAllPeers = function(cb) {
     }
   };
   http.send(null);
-}
+};
 
 module.exports = Peer;
 

Failā izmaiņas netiks attēlotas, jo tās ir par lielu
+ 0 - 0
dist/peer.min.js


Daži faili netika attēloti, jo izmaiņu fails ir pārāk liels