@empathyco/x-components
Version:
Empathy X Components
33 lines (30 loc) • 1.02 kB
JavaScript
import { computed } from 'vue';
import { useStore } from 'vuex';
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';
/**
* Function which returns the requested getter's properties as a dictionary.
*
* @param module - The {@link XModuleName} of the getter.
* @returns The requested getters from the module.
* @public
*/
const useGetter = function useGetter(module) {
const store = useStore();
return new Proxy({}, {
get(_obj, getterName) {
const path = getGetterPath(module, getterName);
// eslint-disable-next-line ts/no-unsafe-member-access,ts/no-unsafe-return
return computed(() => store.getters[path]);
},
});
};
export { useGetter };
//# sourceMappingURL=use-getter.js.map