import store from "@/store"; import { storeMutations } from "@/constants/store-mutations.js"; export default { // Adds event to the bus given its category, subcategory, and eventValue; addEventToBus(category, subCategory, eventValue) { store.commit(storeMutations.ADD_EVENT_TO_BUS, { category: category, subCategory: subCategory, eventValue: eventValue, }); }, // Finds event on the bus, removes the item, and returns its value to the caller. readAndPopEventFromBus(category, subCategory) { const event = store.getters.eventBusItem(category, subCategory); store.commit(storeMutations.REMOVE_EVENT_FROM_BUS, { category: category, subCategory: subCategory, }); return event; }, // Finds the event on the bus and returns its value to the caller, does not remove it. readEventFromBus(category, subCategory) { const event = store.getters.eventBusItem(category, subCategory); return event; }, };