<1 min read
GlobalXBus
GlobalXBus
This component helps subscribing to any XEvent with custom callbacks using Vue listeners API.
Events
This component emits no own events, but you can subscribe to any X Event using Vue listeners
See it in action
This component does not render anything. Its only responsibility is to facilitate listening to any X Event by using Vue component listeners.
<template>
<GlobalXBus @UserAcceptedAQuery="printQuery" />
</template>
<script>
import { GlobalXBus } from '@empathyco/x-components';
export default {
name: 'GlobalXBusTest',
components: {
GlobalXBus
},
methods: {
printQuery(query, metadata) {
console.log('My new query is:', query);
console.log('And has been triggered by this DOM element:', metadata.target);
}
}
};
</script>