Comparing version 0.7.0 to 0.7.1
@@ -135,4 +135,6 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing | ||
var result = function(error, item, more) { | ||
if(arguments.length === 1) { | ||
if(arguments.length === 0) { | ||
more = false; | ||
} else if(arguments.length === 1) { | ||
more = false; | ||
item = error; | ||
@@ -139,0 +141,0 @@ error = undefined; |
{ | ||
"name": "zerorpc", | ||
"version": "0.7.0", | ||
"version": "0.7.1", | ||
"main": "./index.js", | ||
@@ -5,0 +5,0 @@ "author": "dotCloud <opensource@dotcloud.com>", |
@@ -38,7 +38,7 @@ zerorpc-node | ||
addMan: function(sentence, reply) { | ||
reply(null, sentence + ", man!", false); | ||
reply(sentence + ", man!"); | ||
}, | ||
add42: function(n, reply) { | ||
reply(null, n + 42, false); | ||
reply(n + 42); | ||
}, | ||
@@ -48,6 +48,6 @@ | ||
for(i=from; i<to; i+=step) { | ||
reply(null, i, true); | ||
reply(i, true); | ||
} | ||
reply(null, undefined, false); | ||
reply(); | ||
} | ||
@@ -85,3 +85,3 @@ }); | ||
* `method` is the method name. | ||
* `callback` is a method to call when there is an update. This callback is called as `callback(error, response, more)` when there is a new update, where error is an error object, response is the new update, and more is a boolean specifying whether new updates will be available later. | ||
* `callback` is a method to call when there is an update. This callback is called as `callback(error, response, more)` when there is a new update, where error is an error object, response is the new update, and more is a boolean specifying whether new updates will be available later. You can also do `callback()` to close a stream response, `callback(response)` to send a non-stream response without an error, or `callback(response, more)` for a response without an error. | ||
@@ -88,0 +88,0 @@ Full example: |
@@ -243,2 +243,13 @@ // Open Source Initiative OSI - The MIT License (MIT):Licensing | ||
exports.testIncorrectArgumentCount = function(test) { | ||
test.expect(3); | ||
rpcClient.invoke("addMan", function(error, res, more) { | ||
test.ok(error); | ||
test.equal(res, null); | ||
test.equal(more, false); | ||
test.done(); | ||
}); | ||
}; | ||
exports.testNonExistentMethod = function(test) { | ||
@@ -275,9 +286,2 @@ test.expect(3); | ||
}); | ||
}; | ||
//TODO | ||
/*exports.testIncorrectArgumentCount = function(test) { | ||
test.expect(3); | ||
rpcClient.invoke("addMan", ) | ||
};*/ | ||
}; |
46209
14
1080