Created
November 30, 2017 09:20
-
-
Save vzool/ee9c69eec164b1812efca0ab5075e586 to your computer and use it in GitHub Desktop.
Vue.js Global Event Dispatcher
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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