Skip to content

Instantly share code, notes, and snippets.

@Miaababikir
Created September 25, 2018 18:33
Show Gist options
  • Save Miaababikir/a8af843438e7a45d634322fcc5191fca to your computer and use it in GitHub Desktop.
Save Miaababikir/a8af843438e7a45d634322fcc5191fca to your computer and use it in GitHub Desktop.
Vue js events dispatcher
window.Event = new class {
constructor() {
this.vue = new Vue();
}
fire(event, data = null) {
this.vue.$emit(event, data);
}
listen(event, callback) {
this.vue.$on(event, callback);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment