var gcEmitter,
	util = require('util'),
	gcstats = require('./build/Release/gcstats'),
	EventEmitter = require('events').EventEmitter;

function GCStats() {
	if(!gcEmitter) {
		gcEmitter = new EventEmitter();
		gcstats.afterGC(function(stats) {
			gcEmitter.emit('data', stats);
		});
	}

	EventEmitter.call(this);

	gcEmitter.on('data', this.emit.bind(this, 'stats'));
}

util.inherits(GCStats, EventEmitter);

module.exports = GCStats;
var gcEmitter,
	gcstats = require('./build/Release/gcstats'),
	EventEmitter = require('events').EventEmitter;

function gcStats() {
	if (this instanceof gcStats){
        	throw Error('gc-stats no longer exports a constructor. Call without the `new` keyword');
   	}
	if(!gcEmitter) {
		gcEmitter = new EventEmitter();
		gcstats.afterGC(function(stats) {
			gcEmitter.emit('data', stats);
			gcEmitter.emit('stats', stats);
		});
	}
	return gcEmitter;
}

module.exports = gcStats;

Replace constructor with singleton. Emit 'stats' on singleton
Replace constructor with singleton. Emit 'stats' on singleton
