docs(api): add missing hooks and environment column (#6329)

Co-authored-by: Daniel Roe <daniel@roe.dev>
Co-authored-by: Damian Głowala <48835293+DamianGlowala@users.noreply.github.com>
Co-authored-by: Pooya Parsa <pooya@pi0.io>
This commit is contained in:
Sébastien Chopin 2022-08-04 13:12:14 +02:00 committed by GitHub
parent 6d64aff6f2
commit 2abf4a5bc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,27 +1,30 @@
# Lifecycle Hooks
::ReadMore{link="/guide/going-further/hooks"}
::
:ReadMore{link="/guide/going-further/hooks"}
# App Hooks (runtime)
Check the [app source code](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/nuxt.ts#L18) for all available hooks.
Check the [app source code](https://github.com/nuxt/framework/blob/main/packages/nuxt/src/app/nuxt.ts#L24) for all available hooks.
Hook | Arguments | Description
-----------------------|-------------------|---------------
`app:created` | `vueApp` | When initial `vueApp` instance is created
`app:beforeMount` | `vueApp` | Same as `app:created`
`app:mounted` | `vueApp` | When Vue app is initialized and mounted in browser
`app:rendered` | - | When SSR rendering is done
`app:suspense:resolve` | `appComponent` | On [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) resolved event
`page:start` | `pageComponent` | On [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) pending event
`page:finish` | `pageComponent` | On [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) resolved event
`meta:register` | `metaRenderers` | (internal)
`vue:setup` | - | (internal)
Hook | Arguments | Environment | Description
-----------------------|---------------------|-----------------|-------------
`app:created` | `vueApp` | Server & Client | Called when initial `vueApp` instance is created.
`app:error` | `err` | Server & Client | Called when a fatal error occurs.
`app:error:cleared` | `{ redirect? }` | Server & Client | Called when a fatal error occurs.
`app:data:refresh` | `keys?` | Server & Client | (internal)
`meta:register` | `metaRenderers` | Server & Client | (internal)
`vue:setup` | - | Server & Client | (internal)
`vue:error` | `err, target, info` | Server & Client | Called when a vue error propages to the root component. [Learn More](https://vuejs.org/api/composition-api-lifecycle.html#onerrorcaptured).
`app:rendered` | `renderContext` | Server | Called when SSR rendering is done.
`app:redirected` | - | Server | Called before SSR redirection.
`app:beforeMount` | `vueApp` | Client | Called before mounting the app, called only on client side.
`app:mounted` | `vueApp` | Client | Called when Vue app is initialized and mounted in browser.
`app:suspense:resolve` | `appComponent` | Client | On [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) resolved event
`page:start` | `pageComponent?` | Client | Called on [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) pending event.
`page:finish` | `pageComponent?` | Client | Called on [Suspense](https://vuejs.org/guide/built-ins/suspense.html#suspense) resolved event.
# Nuxt Hooks (build time)
Check the [schema source code](https://github.com/nuxt/framework/blob/main/packages/schema/src/types/hooks.ts#L55) for all available hooks.
::NeedContribution
::
:NeedContribution