I'm learning how to use event emitter and inheritance in nodejs. I get the error:
TypeError: this.on is not a function
My code:
const EventEmitter = require('events')
const Emitter = function () {
EventEmitter.call(this)
this.on('event',value => {
console.log('Event emitted',value)
})
}
const myEmitter = new Emitter()
What I'm doing wrong?