Skip to content

Instantly share code, notes, and snippets.

@jeffochoa
Created March 4, 2018 22:53
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jeffochoa/efb9c01ca9d1715a4618a095e292ba1c to your computer and use it in GitHub Desktop.
Save jeffochoa/efb9c01ca9d1715a4618a095e292ba1c to your computer and use it in GitHub Desktop.
Vue event dispatcher
class Event {
constructor() {
this.vue = new Vue();
}
fire(event, data = null) {
this.vue.$emit(event, data);
}
listen(event, callback) {
this.vue.$on(event, callback);
}
}
module.exports = Event;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment