UNPKG

vuestic-ui

Version:
31 lines (30 loc) 1.04 kB
import { getCurrentInstance, inject as inject$1 } from "vue"; import { t as throwError } from "../utils/console.mjs"; let currentApp = null; let prevRegisteredApp = null; const setCurrentApp = (newApp) => { if ((prevRegisteredApp == null ? void 0 : prevRegisteredApp._instance) === null) { prevRegisteredApp = null; } if (newApp === null && prevRegisteredApp === null) { return; } prevRegisteredApp = currentApp; currentApp = newApp; }; const getCurrentApp = () => currentApp; const inject = (key, value = void 0) => { var _a; const injectedFromApp = (_a = getCurrentApp()) == null ? void 0 : _a._context.provides[key]; const vm = getCurrentInstance(); if (vm) { return inject$1(key, value); } return injectedFromApp ?? throwError("You're using Vuestic composable outside Vue app. Since you registered Vuestic in multiple apps, composables can not be used outside setup function anymore."); }; export { getCurrentApp as g, inject as i, setCurrentApp as s }; //# sourceMappingURL=current-app.mjs.map