UNPKG

nuxt

Version:

Nuxt is a free and open-source framework with an intuitive and extendable way to create type-safe, performant and production-grade full-stack web applications and websites with Vue.js.

8 lines (7 loc) 287 B
import { getCurrentInstance, withAsyncContext as withVueAsyncContext } from "vue"; export function withAsyncContext(fn) { return withVueAsyncContext(() => { const nuxtApp = getCurrentInstance()?.appContext.app.$nuxt; return nuxtApp ? nuxtApp.runWithContext(fn) : fn(); }); }