Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.


Node.js / EventEmitter / eventNames

node v8.17.0
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(','))

no comments

    sign in to comment