From 7f5f554503e2dc0c9bf05c723c9bc10ff03eb1d2 Mon Sep 17 00:00:00 2001 From: brianc Date: Thu, 3 Mar 2011 18:07:22 +0000 Subject: [PATCH] js client emits 'connect' event --- lib/client.js | 3 ++- lib/index.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/client.js b/lib/client.js index 3af94fe0..4e3f8112 100644 --- a/lib/client.js +++ b/lib/client.js @@ -78,7 +78,8 @@ p.connect = function() { con.sync(); } }); - + + self.emit('connect'); }); con.on('readyForQuery', function() { diff --git a/lib/index.js b/lib/index.js index 4fe24fe5..60778e0c 100644 --- a/lib/index.js +++ b/lib/index.js @@ -15,7 +15,7 @@ var connect = function(config, callback) { client.connect(); var onError = function(error) { - client.connection.removeListener('readyForQuery', onReady); + client.removeListener('connect', onReady); callback(error); } @@ -30,7 +30,7 @@ var connect = function(config, callback) { //TODO refactor //i don't like reaching into the client's connection for attaching //to specific events here - client.connection.once('readyForQuery', onReady); + client.once('connect', onReady); }