UNPKG

vuex-smart-module

Version:

Type safe Vuex module with powerful module features

12 lines (11 loc) 444 B
import { getCurrentInstance } from 'vue-demi'; import { assert } from './utils'; export function createComposable(module) { return function useContext() { var _a; var vm = (_a = getCurrentInstance()) === null || _a === void 0 ? void 0 : _a.proxy; assert(vm, 'Failed to get the current component instance'); assert(vm.$store, 'Vuex store is not installed'); return module.context(vm.$store); }; }