Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
feat(mixin): Automate event registration & removal on root vm #581
It's interesting; a lot of Vue blog posts talk about instantiating an empty Vue component and calling it EventBus, but that assumes a way for every component to access the EventBus. Apart from multiple Vue roots, this pattern of using root as the global bus makes more sense as it doesn't assume/require anything (perfect for a library).
I'm using vuex in my project, and while it largely eliminates the need for global events, there are still valid use-cases. For example, toggling a global "Are you sure?" modal (as you've seen screen captured). I also use this root event bussing to trigger the global login modal.