Skip to content

Instantly share code, notes, and snippets.

@an-parubets
Last active December 26, 2022 16:57
Show Gist options
  • Save an-parubets/3368aef2d9d0b21cea0aab620b041b1b to your computer and use it in GitHub Desktop.
Save an-parubets/3368aef2d9d0b21cea0aab620b041b1b to your computer and use it in GitHub Desktop.
EventEmitter
/**
* @param {string} eventName
* @param {any} args
*/
emit(eventName, args) {
const event = this.events[eventName];
event && event.forEach(callback => callback.call(null, args));
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment