vuestic-ui
Version:
Vue 3 UI Framework
1 lines • 787 B
Source Map (JSON)
{"version":3,"file":"useAppContext.mjs","sources":["../../../../src/composables/useAppContext.ts"],"sourcesContent":["import { computed, getCurrentInstance } from 'vue'\nimport { getCurrentApp } from '../services/current-app'\n\n/**\n * App context must be used as computed to support single app mode.\n *\n * Single app mode allows user to use composables as useColor, useToast, etc. outside of vue app.\n * (for example in api.ts)\n */\nexport const useAppContext = () => {\n const currentInstance = getCurrentInstance()\n\n return computed(() => {\n return getCurrentApp()?._context || currentInstance?.appContext\n })\n}\n"],"names":[],"mappings":";;AASO,MAAM,gBAAgB,MAAM;AACjC,QAAM,kBAAkB;AAExB,SAAO,SAAS,MAAM;;AACb,aAAA,mBAAiB,MAAjB,mBAAiB,cAAY,mDAAiB;AAAA,EAAA,CACtD;AACH;"}