Permalink
Browse files

meta params work with service()

  • Loading branch information...
substack committed Mar 6, 2012
1 parent 4f5a124 commit 7b79bdaa5678fef8274b79ab33eec6171e00a8a3
Showing with 13 additions and 3 deletions.
  1. +13 −3 index.js
View
@@ -55,10 +55,20 @@ exports.connect = function () {
});
};
- self.service = function (role, fn) {
- self.allocate(role, function (port, ready) {
+ self.service = function (role, params, fn) {
+ if (typeof role === 'object') {
+ fn = params;
+ params = role;
+ role = params.role;
+ }
+ else if (typeof params === 'function') {
+ fn = params;
+ params = {};
+ }
+
+ self.allocate(role, params, function (port, ready) {
up.on('up', function () {
- self.assume(role, port);
+ self.assume(role, params, port);
});
fn(port, ready);

0 comments on commit 7b79bda

Please sign in to comment.