core
Access the hooks of Unhead.
Type:
(entry: Input, options?: HeadEntryOptions) => ActiveHeadEntry<Input>
Can be used to register and call the hooks of Unhead. Powered by Hookable.
Hooks are used for all core functionality within Unhead.
import { createHead } from 'unhead'
const head = createHead()
// trigger DOM rendering
head.hooks.callHook('entries:updated')
import { createHead } from 'unhead'
const head = createHead({
hooks: {
init() { console.log('ready') }
}
})
'init'
: ctx: Unhead<any>
.'entries:updated'
: ctx: Unhead<any>
.'entries:resolve'
: ctx: EntryResolveCtx<any>
.'tag:normalise'
: ctx: { tag: HeadTag; entry: HeadEntry<any>; resolvedOptions: CreateHeadOptions }
.'tags:beforeResolve'
: ctx: { tags: HeadTag[] }
.'tags:resolve'
: ctx: { tags: HeadTag[] }
.'dom:beforeRender'
: ctx: ShouldRenderContext & { tags: DomRenderTagContext[] }
.'dom:renderTag'
: ctx: DomRenderTagContext
, document: Document
, and track: any
.'dom:rendered'
: ctx: { renders: DomRenderTagContext[] }
.'ssr:beforeRender'
: ctx: ShouldRenderContext
.'ssr:render'
: ctx: { tags: HeadTag[] }
.'ssr:rendered'
: ctx: SSRRenderContext
.