Instantly share code, notes, and snippets.

Embed
What would you like to do?
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