Skip to content

Instantly share code, notes, and snippets.

@jagoncalves14
Created October 21, 2022 10:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagoncalves14/858dbe5c542179201455238060271b7d to your computer and use it in GitHub Desktop.
Save jagoncalves14/858dbe5c542179201455238060271b7d to your computer and use it in GitHub Desktop.
[Vue] Composable for accessing Global Properties
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