UNPKG

@empathyco/x-components

Version:
32 lines (29 loc) 1.03 kB
import { computed } from 'vue'; import '@vue/devtools-api'; import '../plugins/devtools/timeline.devtools.js'; import '@empathyco/x-utils'; import 'rxjs/operators'; import 'rxjs'; import '../plugins/devtools/colors.utils.js'; import '../plugins/x-bus.js'; import '../plugins/x-plugin.js'; import { getGetterPath } from '../plugins/x-plugin.utils.js'; import { useStore } from 'vuex'; /** * Function which returns the requested getters as a dictionary of getters. * * @param module - The {@link XModuleName} of the getter. * @param getters - List of getters names. * @returns The requested getters from the module. * @public */ function useGetter(module, getters) { const store = useStore(); return getters.reduce((getterDictionary, getterName) => { const getterPath = getGetterPath(module, getterName); getterDictionary[getterName] = computed(() => store.getters[getterPath]); return getterDictionary; }, {}); } export { useGetter }; //# sourceMappingURL=use-getter.js.map