Skip to content

Commit

Permalink
Merge branch '0.7' of github.com:Flotype/now into 0.7
Browse files Browse the repository at this point in the history
  • Loading branch information
steveWang committed Jul 14, 2011
2 parents 336953d + 3543f45 commit b16331f
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions lib/client/now.js
Expand Up @@ -316,6 +316,7 @@
util.emit('rfc', data);
});
socket.on('rv', function (data) {

lib.replaceVar(data);
util.emit('rv', data);
});
Expand Down Expand Up @@ -351,7 +352,6 @@
},
processNowScope: function () {
lib.processScope(now, 'now');

clearTimeout(lastTimeout);
if (socket.socket.connected)
lastTimeout = setTimeout(lib.processNowScope, 1000);
Expand All @@ -361,8 +361,11 @@
lib.traverseScope(obj, path, data);
// Send only for non-empty object
for (var i in data) {

if(util.hasProperty(data, i) && data[i] !== undefined) {

socket.emit('rv', data);

break;
}
}
Expand All @@ -371,14 +374,15 @@
if (obj && typeof obj === 'object') {
var objIsArray = util.isArray(obj);
var keys = fqnMap.get(path);

for (var key in obj) {
var fqn = path + '.' + key;
var val = obj[key];

if (fqn === 'now.core' || fqn === 'now.ready') {
continue;
}

var type = typeof val;
if (util.hasProperty(obj, key)) {
if (isIE || objIsArray) {
Expand Down Expand Up @@ -431,10 +435,13 @@
socket.on('connect', function () {
now.core.clientId = socket.socket.sessionid;
lib.handleNewConnection(socket);

// Begin intermittent scope traversal
lib.processNowScope();
socket.emit('rd');

setTimeout(function(){
lib.processNowScope();
socket.emit('rd');
}, 100);

util.emit('connect');
});
socket.on('disconnect', function () {
Expand Down

0 comments on commit b16331f

Please sign in to comment.