Skip to content

Instantly share code, notes, and snippets.

@pori
Created July 5, 2016 04:29
Show Gist options
  • Save pori/52f840de5ac0b99ba7d4207a5e72daac to your computer and use it in GitHub Desktop.
Save pori/52f840de5ac0b99ba7d4207a5e72daac to your computer and use it in GitHub Desktop.
import EventEmitter from 'events';
export default class EventTarget extends EventEmitter {
addEventListener(type, cb, options = {}) {
this.on(type, cb);
}
removeEventListener(type, cb, options = {}) {
this.removeListener(type, cb);
}
dispatchEvent(event) {
this.emit(event.type, event);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment