Nuxt/test/fixtures/basic/composables/async-context.ts
pooya parsa 554f868bce
feat(nuxt): experimental native async context support (#20918)
Co-authored-by: Daniel Roe <daniel@roe.dev>
2023-08-08 00:57:35 +02:00

20 lines
324 B
TypeScript

const delay = () => new Promise(resolve => setTimeout(resolve, 10))
export async function nestedAsyncComposable () {
await delay()
return await fn1()
}
async function fn1 () {
await delay()
return await fn2()
}
async function fn2 () {
await delay()
const app = useNuxtApp()
return {
hasApp: !!app
}
}