Created
February 11, 2017 09:34
-
-
Save arvidkahl/fd59d57956ea87342fa58468310e242f to your computer and use it in GitHub Desktop.
components-eventbus.js
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
// Two isolated components accessing the same global | |
let ComponentA = Vue.extend({ | |
created: function(){ | |
EventBus.$on(“thatEvent”, ()=>{ | |
console.log(“Event received”); | |
}) | |
} | |
}); | |
let ComponentB = Vue.extend({ | |
created: function(){ | |
EventBus.$emit(“thatEvent”); | |
console.log(“Event emitted.”) | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment