Created
October 21, 2022 10:33
-
-
Save jagoncalves14/858dbe5c542179201455238060271b7d to your computer and use it in GitHub Desktop.
[Vue] Composable for accessing Global Properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getCurrentInstance } from 'vue' | |
export default function useGlobalProperties() { | |
const internalInstance = getCurrentInstance() | |
const globalProperties = internalInstance.appContext.config.globalProperties | |
return globalProperties | |
} | |
/** | |
* Usage example: | |
import useGlobalProperties from 'composables/use-global-properties.ts' | |
const { $notify, $error, $strings } = useGlobalProperties() | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment