vue listen to emit global event code example Example: how to emit a function in vue this.$emit('myEvent')