Event emitter for function object in separate module

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() {});