Permalink
Browse files

Turns out setting .__proto__ to an array doesn't actually change JSON…

….stringify's view of an object. Revert those changes. Also, more minor formatting.
  • Loading branch information...
1 parent 10f311c commit 6539c31e2c3766dc99d777221fd5ba580acfa789 @steveWang steveWang committed Jun 22, 2011
Showing with 15 additions and 14 deletions.
  1. +8 −8 lib/function.js
  2. +0 −2 lib/nowUtil.js
  3. +1 −1 lib/proxy.js
  4. +1 −1 lib/scopeTable.js
  5. +5 −2 package.json
View
@@ -21,24 +21,24 @@ exports.init = function (nowjs) {
remotecall: function () {
// Coerce arguments to an array.
- arguments.__proto__ = nowUtil.arrayProto;
+ var args = Array.prototype.slice.call(arguments);
// Find functions in the arguments, and store functions in
// closure table and serialize functions.
var closureId;
- for (var i = 0, ii = arguments.length; i < ii; i++) {
- if (typeof arguments[i] === 'function') {
- closureId = 'closure_' + arguments[i].name + '_' +
+ for (var i = 0, ii = args.length; i < ii; i++) {
+ if (typeof args[i] === 'function') {
+ closureId = 'closure_' + args[i].name + '_' +
nowUtil.generateRandombString();
- nowjs.closures[closureId] = arguments[i];
- arguments[i] = {closure: closureId};
- setTimeout(function() {
+ nowjs.closures[closureId] = args[i];
+ args[i] = {closure: closureId};
+ setTimeout(function () {
nowjs.closures[closureId] = nowUtil.noop;
}, 30000);
}
}
// On the next tick, send the remoteCall request
- this.socket.emit('rfc', {fqn: this.fqn, args: arguments});
+ this.socket.emit('rfc', {fqn: this.fqn, args: args});
}
};
};
View
@@ -7,8 +7,6 @@ var util = {
noop: function () {
},
- arrayProto: [],
-
clone: function (obj) {
var output = {};
output.__proto__ = obj;
View
@@ -29,7 +29,7 @@ exports.wrap = function (entity) {
enumerate : function () {
return entity.get(path);
},
- hasOwn : function(name) {
+ hasOwn : function (name) {
return entity.scopeTable.get(path+'.'+name) !== undefined;
},
delete : function (name) {
View
@@ -25,7 +25,7 @@ ScopeTable.prototype.delete = function (fqn) {
var lastIndex = fqn.lastIndexOf('.');
var parent = fqn.substring(0, lastIndex);
- if(nowUtil.hasProperty(this.data, parent)){
+ if (nowUtil.hasProperty(this.data, parent)) {
// Remove from its parent.
this.data[parent].splice(
this.data[parent].indexOf(fqn.substring(lastIndex + 1)),
View
@@ -1,7 +1,7 @@
{
"author": "Flotype",
"name": "now",
- "version": "0.0.1",
+ "version": "0.7.0",
"repository": {
"type": "git",
"url": "git://github.com/Flotype/now-bamf.git"
@@ -10,6 +10,9 @@
"engines": {
"node": "v0.4.5"
},
- "dependencies": {},
+ "dependencies": {
+ "socket.io": "0.7.2",
+ "node-proxy": "0.3.2"
+},
"devDependencies": {}
}

0 comments on commit 6539c31

Please sign in to comment.