Created
September 23, 2018 14:02
-
-
Save wmcmurray/21600a7fdfb8befadb093b4fe8f3e578 to your computer and use it in GitHub Desktop.
A simple events bus used to pub/sub global events across unrelated parts of a VueJS app.
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
import Vue from 'vue' | |
var MEDIATOR_VUE = new Vue(); | |
var MEDIATOR = { | |
emit : MEDIATOR_VUE.$emit.bind(MEDIATOR_VUE), | |
on : MEDIATOR_VUE.$on.bind(MEDIATOR_VUE), | |
off : MEDIATOR_VUE.$off.bind(MEDIATOR_VUE), | |
once : MEDIATOR_VUE.$once.bind(MEDIATOR_VUE), | |
}; | |
export default MEDIATOR |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment