Browse Source

Merge pull request #19 from lovebear/bugfix

2 global variables bugfix
Michelle Bu 12 năm trước cách đây
mục cha
commit
3d9ab3533f
2 tập tin đã thay đổi với 2 bổ sung2 xóa
  1. 1 1
      lib/peer.js
  2. 1 1
      lib/socket.js

+ 1 - 1
lib/peer.js

@@ -93,7 +93,7 @@ Peer.prototype._init = function() {
 Peer.prototype._handleServerJSONMessage = function(message) {
   var peer = message.src;
   var connection = this.connections[peer];
-  payload = message.payload;
+  var payload = message.payload;
   switch (message.type) {
     case 'OPEN':
       this._processQueue();

+ 1 - 1
lib/socket.js

@@ -120,7 +120,7 @@ Socket.prototype.send = function(data) {
     return;
   }
   
-  message = JSON.stringify(data);
+  var message = JSON.stringify(data);
   if (this._wsOpen()) {
     this._socket.send(message);
   } else {