From b67f083cf866cc70f5ada367a3e55b95aa94d9c3 Mon Sep 17 00:00:00 2001 From: ericz Date: Sat, 12 Mar 2011 02:38:51 -0800 Subject: [PATCH] fixed cross-port bugs --- lib/now.js | 6 +++++- lib/nowServerLib.js | 10 ---------- lib/nowUtil.js | 4 +--- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/lib/now.js b/lib/now.js index e650ee8..aed1669 100644 --- a/lib/now.js +++ b/lib/now.js @@ -38,6 +38,10 @@ window.onload = function(){ now = nowCore.scopes[SERVER_ID]; + var ready = nowOld.ready; + + delete nowOld.ready; + nowUtil.initializeScope(nowOld, socket); nowUtil.addChildrenToBlacklist(nowCore.watchersBlacklist[SERVER_ID], nowOld, "now"); @@ -52,7 +56,7 @@ window.onload = function(){ // Call the ready handlers - now.ready(); + ready(); }); var socket = new io.Socket('**SERVER**', {port: **PORT**}); diff --git a/lib/nowServerLib.js b/lib/nowServerLib.js index 6b2e78b..ff79025 100644 --- a/lib/nowServerLib.js +++ b/lib/nowServerLib.js @@ -100,16 +100,6 @@ function serveFile(filename, request, response){ } - - - - - - - - - - exports.handleNewConnection = function(client){ client.on('message', function(message){ diff --git a/lib/nowUtil.js b/lib/nowUtil.js index c12cdf4..153c944 100644 --- a/lib/nowUtil.js +++ b/lib/nowUtil.js @@ -236,9 +236,7 @@ nowUtil.mergeScopes = function(current, incoming) { } nowUtil.mergeScopes(current[prop], incoming[prop]); } else { - if(!current.hasOwnProperty(prop)){ - current[prop] = incoming[prop]; - } + current[prop] = incoming[prop]; } } }