UNPKG

@empathyco/x-components

Version:
33 lines (30 loc) 1.04 kB
import { defineComponent } from 'vue'; import { useXBus } from '../../../composables/use-x-bus.js'; import { experienceControlsXModule } from '../x-module.js'; /** * This component subscribes to changes in the ExperienceControls module to fire the events that * propagate the configuration. * * @public */ var _sfc_main = defineComponent({ name: 'ExperienceControls', xModule: experienceControlsXModule.name, setup() { const xBus = useXBus(); /** * Iterates the list of XEvents received and emits them. * * @param events - Events to be emitted. */ function onEventsChanged(events) { Object.entries(events).forEach(([eventName, eventPayload]) => { xBus.emit(eventName, eventPayload); }); } xBus.on('ExperienceControlsEventsChanged', false).subscribe(event => onEventsChanged(event)); return () => { }; }, }); export { _sfc_main as default }; //# sourceMappingURL=experience-controls.vue.js.map