UNPKG

@nextcloud/vue

Version:
47 lines (46 loc) 1.27 kB
import { loadState } from "@nextcloud/initial-state"; import { inject } from "vue"; import { l as logger } from "./logger-D3RVzcfQ.mjs"; /*! * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ function once(func) { let wasCalled = false; let result; return (...args) => { if (!wasCalled) { wasCalled = true; result = func(...args); } return result; }; } let realAppName = "missing-app-name"; try { realAppName = appName; } catch { logger.error("The `@nextcloud/vue` library was used without setting / replacing the `appName`."); } const APP_NAME = realAppName; let realAppVersion = ""; try { realAppVersion = appVersion; } catch { logger.error("The `@nextcloud/vue` library was used without setting / replacing the `appVersion`."); } const APP_VERSION = realAppVersion; function useAppName() { return inject("appName", APP_NAME); } const useLocalizedAppName = once(() => { const apps = loadState("core", "apps", []); const realAppName2 = useAppName(); return apps.find(({ id }) => id === realAppName2)?.name ?? realAppName2; }); export { APP_VERSION as A, useAppName as a, useLocalizedAppName as u }; //# sourceMappingURL=appName-DyNMVZpX.mjs.map