Permalink
Browse files

add beforeServerSend and beforeServerRecv functions to allow global a…

…bilities for things like global logging if errors etc
  • Loading branch information...
1 parent 957e7ac commit 90269a7808a72016c26d18b6e01f18144086abb0 @zachaller zachaller committed Apr 27, 2012
Showing with 13 additions and 3 deletions.
  1. +13 −3 lib/client/now.js
View
@@ -283,7 +283,13 @@
removeEvent: util.removeEvent,
clientId: undefined,
noConflict: noConflict
- }
+ },
+ beforeServerSend: function(data, callback) {
+ callback(data);
+ },
+ beforeServerRecv: function(args, fqn, callback) {
+ callback(args);
+ }
};
lib = {
@@ -343,7 +349,9 @@
args[i] = lib.constructRemoteFunction(args[i].fqn);
}
}
- func.apply({now: now}, args);
+ now.beforeServerRecv(args, data.fqn, function(args) {
+ func.apply({now: now}, args);
+ });
},
// Handle the ready message from the server
@@ -369,7 +377,9 @@
args[i] = {fqn: closureId};
}
}
- socket.emit('rfc', {fqn: fqn, args: args});
+ now.beforeServerSend({fqn: fqn, args: args}, function(data) {
+ socket.emit('rfc', {fqn: data.fqn, args: data.args});
+ });
};
remoteFn.remote = true;
return remoteFn;

0 comments on commit 90269a7

Please sign in to comment.