Node.js / EventEmitter / eventNames

node v8.17.0
endpointsharetweet
const EventEmitter = require("events") class MyEmitter extends EventEmitter{} const emitter = new MyEmitter(); emitter .on("message", () => console.log('a message was emitted')) .on("message", () => console.log('this is not the right message')) .on("data", () => console.log('a data just occured')) console.log(emitter.eventNames().join(',')) emitter.removeAllListeners("data") console.log(emitter.eventNames().join(','))
Loading…

no comments

    sign in to comment