const EventEmitter = require('events').EventEmitter;
function MyEmitter() {
if (!(this instanceof MyEmitter)) return new MyEmitter();
EventEmitter.call(this);
this.init();
}
inherits(MyEmitter, EventEmitter);
Usage...
const myem = require('./my-emitter');
let myEmitter = myem.MyEmitter();
myEmitter.on("event", function() {});