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
ericz committed Jul 8, 2011
2 parents e57797a + 690c380 commit 3543f45
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
2 changes: 1 addition & 1 deletion lib/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ exports.init = function (now) {
if (typeof args[i] === 'function') {
closureId = 'closure_' + args[i].name + '_' + nowUtil.generateRandomString();
now.closures[closureId] = args[i];
args[i] = {closure: closureId};
args[i] = {fqn: closureId};
setTimeout(function () {
now.closures[closureId] = nowUtil.noop;
}, now.options.closureTimeout);
Expand Down
6 changes: 5 additions & 1 deletion lib/now.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,8 @@ Now.prototype.initialize = function (server, options) {
return everyone;
};

exports.Now = Now;
process.on('uncaughtException', function (err) {
nowUtil.error(err);
});

exports.Now = Now;
9 changes: 8 additions & 1 deletion lib/nowUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ var util = {
return Math.random().toString().substr(2);
},

error: function(err){
console.log(err);
if(nowUtil.hasProperty(err, 'stack')){
console.log(err.stack);
}
},

getAllChildFqns: function (parentObj, parentFqn) {
var fqns = [];

Expand Down Expand Up @@ -70,7 +77,7 @@ var util = {
return val;
}
},

isEmptyObj: function(obj){
for (var i in obj) {
return false;
Expand Down
7 changes: 6 additions & 1 deletion lib/user.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ exports.initialize = function (now) {

// Remote function call handler
socket.on('rfc', function rfcHandler(data) {
var theFunction = self.get(data.fqn);
var theFunction;
if(data.fqn.split("_")[0] === 'closure'){
theFunction = now.closures[data.fqn];
} else {
theFunction = self.get(data.fqn);
}
var args = data.args;
// Convert any remote function stubs into remote functions
var user;
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"node": ">= v0.4.0"
},
"dependencies": {
"socket.io": "0.7.2",
"socket.io": ">= 0.7.2",
"node-proxy": "0.4.0"
},
"devDependencies": {}
Expand Down

0 comments on commit 3543f45

Please sign in to comment.