js client emits 'connect' event

This commit is contained in:
brianc 2011-03-03 18:07:22 +00:00
parent 08eddd26e2
commit 7f5f554503
2 changed files with 4 additions and 3 deletions

View File

@ -78,7 +78,8 @@ p.connect = function() {
con.sync();
}
});
self.emit('connect');
});
con.on('readyForQuery', function() {

View File

@ -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);
}