Skip to content

Instantly share code, notes, and snippets.

@vzool
Created November 30, 2017 09:20
Show Gist options
  • Save vzool/ee9c69eec164b1812efca0ab5075e586 to your computer and use it in GitHub Desktop.
Save vzool/ee9c69eec164b1812efca0ab5075e586 to your computer and use it in GitHub Desktop.
Vue.js Global Event Dispatcher
window.Event = {
vue: new Vue(),
on: function(event, callback){
this.vue.$on(event, callback);
},
fire: function(event, data){
this.vue.$emit(event, data);
},
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment