mirror of
https://github.com/brianc/node-postgres.git
synced 2025-12-08 20:16:25 +00:00
added EventEmitter.once compatibility
This commit is contained in:
parent
f9f7e0759d
commit
d45c905978
@ -3,7 +3,7 @@ var net = require('net');
|
||||
var Query = require(__dirname+'/query');
|
||||
var sys = require('sys');
|
||||
var crypto = require('crypto');
|
||||
|
||||
var utils = require(__dirname + '/utils');
|
||||
var Client = function(config) {
|
||||
EventEmitter.call(this);
|
||||
config = config || {};
|
||||
|
||||
11
lib/utils.js
Normal file
11
lib/utils.js
Normal file
@ -0,0 +1,11 @@
|
||||
var events = require('events');
|
||||
|
||||
if(typeof events.EventEmitter.prototype.once !== 'function') {
|
||||
events.EventEmitter.prototype.once = function (type, listener) {
|
||||
var self = this;
|
||||
self.on(type, function g () {
|
||||
self.removeListener(type, g);
|
||||
listener.apply(this, arguments);
|
||||
});
|
||||
};
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user