Created
September 25, 2018 18:33
-
-
Save Miaababikir/a8af843438e7a45d634322fcc5191fca to your computer and use it in GitHub Desktop.
Vue js events dispatcher
This file contains hidden or 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 = 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