Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ombak/6c3050b2bc57b0e9ce37f0acdadf8989 to your computer and use it in GitHub Desktop.
Save ombak/6c3050b2bc57b0e9ce37f0acdadf8989 to your computer and use it in GitHub Desktop.
const EventEmitter = require('events');
class MyEmitter extends EventEmitter {}
const myEmitter = new MyEmitter();
myEmitter.on('event', () => {
console.log('an event occurred!');
});
myEmitter.emit('event');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment