mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-14 10:04:05 +00:00
16 lines
396 B
TypeScript
16 lines
396 B
TypeScript
import { getContext } from 'unctx'
|
|
import type { Nuxt } from '@nuxt/schema'
|
|
|
|
/** Direct access to the Nuxt context - see https://github.com/unjs/unctx. */
|
|
export const nuxtCtx = getContext<Nuxt>('nuxt')
|
|
|
|
/**
|
|
* Get access to Nuxt (if run within the Nuxt context) - see https://github.com/unjs/unctx.
|
|
*
|
|
* @example
|
|
* ```js
|
|
* const nuxt = useNuxt()
|
|
* ```
|
|
*/
|
|
export const useNuxt = nuxtCtx.use
|