Michelle Bu %!s(int64=12) %!d(string=hai) anos
pai
achega
f8da40c273
Modificáronse 4 ficheiros con 7 adicións e 19 borrados
  1. 3 9
      demo/static/peer.js
  2. 3 9
      dist/peer.js
  3. 0 0
      dist/peer.min.js
  4. 1 1
      lib/peer.js

+ 3 - 9
demo/static/peer.js

@@ -888,12 +888,6 @@ Peer.prototype._startSocket = function() {
   this._socket.on('message', function(data) {
     self._handleServerJSONMessage(data);
   });
-  this._socket.on('open', function() {
-    if (self.id) {
-      self.emit('open', self.id);
-      self._processQueue();
-    }
-  });
   this._socket.on('error', function(error) {
     util.log(error);
     self.emit('error', error);
@@ -913,13 +907,13 @@ Peer.prototype._handleServerJSONMessage = function(message) {
   var peer = message.src;
   var connection = this.connections[peer];
   switch (message.type) {
-    case 'ID':
+    case 'OPEN':
       if (!this.id) {
         // If we're just now getting an ID then we may have a queue.
         this.id = message.id;
-        this.emit('open', this.id);
-        this._processQueue();
       }
+      this.emit('open', this.id);
+      this._processQueue();
       break;
     case 'ERROR':
       this.emit('error', message.msg);

+ 3 - 9
dist/peer.js

@@ -888,12 +888,6 @@ Peer.prototype._startSocket = function() {
   this._socket.on('message', function(data) {
     self._handleServerJSONMessage(data);
   });
-  this._socket.on('open', function() {
-    if (self.id) {
-      self.emit('open', self.id);
-      self._processQueue();
-    }
-  });
   this._socket.on('error', function(error) {
     util.log(error);
     self.emit('error', error);
@@ -913,13 +907,13 @@ Peer.prototype._handleServerJSONMessage = function(message) {
   var peer = message.src;
   var connection = this.connections[peer];
   switch (message.type) {
-    case 'ID':
+    case 'OPEN':
       if (!this.id) {
         // If we're just now getting an ID then we may have a queue.
         this.id = message.id;
-        this.emit('open', this.id);
-        this._processQueue();
       }
+      this.emit('open', this.id);
+      this._processQueue();
       break;
     case 'ERROR':
       this.emit('error', message.msg);

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 0 - 0
dist/peer.min.js


+ 1 - 1
lib/peer.js

@@ -72,8 +72,8 @@ Peer.prototype._handleServerJSONMessage = function(message) {
       if (!this.id) {
         // If we're just now getting an ID then we may have a queue.
         this.id = message.id;
+        this.emit('id', this.id);
       }
-      this.emit('open', this.id);
       this._processQueue();
       break;
     case 'ERROR':

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio