@ogygia/core · API
@ogygia/core/plugin/client
A plugin's browser half. defineClient, its boot context, and the runtime hooks with the type of each hook's event.
On this page
- defineClient
- AnswerParsedEvent
- AnswerParsedEvent.fragment
- AnswerPlacedEvent
- AnswerPlacedEvent.el
- ClientBootContext
- ClientBootContext.kitPage
- ClientPlugin
- ClientPlugin.boot
- ClientPlugin.hooks
- CriticalSettledEvent
- CriticalSettledEvent.outcome
- CriticalSettledEvent.resources
- CriticalSettledEvent.waitedMs
- EntryFallbackEvent
- EntryFallbackEvent.entry
- EntryFallbackEvent.src
- EntryFallbackEvent.recovered
- HoleAnsweredEvent
- HoleAnsweredEvent.el
- HoleAnsweredEvent.start
- HoleAnsweredEvent.batch
- HoleBatchMissedEvent
- HoleBatchMissedEvent.sent
- HoleBatchMissedEvent.delivered
- HoleBatchMissedEvent.status
- HoleBatchMissedEvent.refused
- HoleBatchMissedEvent.finalUrl
- HoleBatchMissedEvent.endpoints
- HoleFailedEvent
- HoleFailedEvent.el
- HoleFailedEvent.id
- HoleFailedEvent.reason
- HoleFailedEvent.finalPath
- HoleFailedEvent.message
- HoleFailedEvent.attempts
- HoleFailedEvent.t
- LoadStartedEvent
- LoadStartedEvent.class
- LoadStartedEvent.kind
- LoadStartedEvent.label
- LoadStartedEvent.waitedMs
- NavigatedEvent
- NavigatedEvent.from
- NavigatedEvent.to
- NavigatedEvent.type
- NavigatedEvent.t
- NavigatedEvent.fetched
- NavigatedEvent.styled
- NavigatedEvent.swapped
- NavigatedEvent.href
- NavigatedEvent.reconciled
- NavStartedEvent
- NavStartedEvent.from
- NavStartedEvent.to
- NavStartedEvent.type
- PageGlobals
- RegionFailedEvent
- RegionFailedEvent.el
- RegionFailedEvent.message
- RegionFailedEvent.since
- RegionFailedEvent.turn
- RegionHydratedEvent
- RegionHydratedEvent.el
- RegionHydratedEvent.t0
- RegionHydratedEvent.tLoaded
- RegionHydratedEvent.tTurn
- RegionHydratedEvent.tDone
- RegionHydratedEvent.ssrHtml
- RegionHydrateEvent
- RegionHydrateEvent.el
- RegionMismatchedEvent
- RegionMismatchedEvent.el
- RegionMismatchedEvent.kind
- RegionMismatchedEvent.reason
- RegionMountEvent
- RegionMountEvent.el
- RegionMountEvent.entry
- RegionMountEvent.urls
- RegionUnmountEvent
- RegionUnmountEvent.el
- RegionUnmountEvent.entry
- RegionWokeEvent
- RegionWokeEvent.el
- RegionWokeEvent.when
- ReloadNeededEvent
- ReloadNeededEvent.url
- ReloadNeededEvent.error
- ReloadNeededEvent.regions
- RestoreLogEntry
- RestoreLogEntry.kind
- RestoreLogEntry.host
- RestoreLogEntry.t
- RestoreLogEntry.diff
- RestoreLogEntry.key
- RestoreLogEntry.island
- RuntimeHooks
- RuntimeHooks.regionMount
- RuntimeHooks.regionUnmount
- RuntimeHooks.regionHydrate
- RuntimeHooks.answerParsed
- RuntimeHooks.answerPlaced
- RuntimeHooks.regionHydrated
- RuntimeHooks.regionFailed
- RuntimeHooks.regionWoke
- RuntimeHooks.regionMismatched
- RuntimeHooks.holeAnswered
- RuntimeHooks.holeFailed
- RuntimeHooks.holeBatchMissed
- RuntimeHooks.entryFallback
- RuntimeHooks.reloadNeeded
- RuntimeHooks.navStarted
- RuntimeHooks.navigated
- RuntimeHooks.criticalSettled
- RuntimeHooks.loadStarted
- RuntimeHooks.warning
- WarningEvent
- WarningEvent.code
- WarningEvent.message
- WarningEvent.file
- WarningEvent.fp
- WarningEvent.t
- CriticalOutcome
- HoleRefusal
- PendingShadow
- RegionMismatch
- RuntimeHookName
- WaitingShadow
This page is generated from the package’s own .d.ts files on every build, so the signatures, descriptions and examples below always match the source. ogygia/plugin/client re-exports the same module. The plugin API is internal and can change in any release (Core). Browser hooks explains it.
Exports defineClient · AnswerParsedEvent · AnswerPlacedEvent · ClientBootContext · ClientPlugin · CriticalSettledEvent · EntryFallbackEvent · HoleAnsweredEvent · HoleBatchMissedEvent · HoleFailedEvent · LoadStartedEvent · NavigatedEvent · NavStartedEvent · PageGlobals · RegionFailedEvent · RegionHydratedEvent · RegionHydrateEvent · RegionMismatchedEvent · RegionMountEvent · RegionUnmountEvent · RegionWokeEvent · ReloadNeededEvent · RestoreLogEntry · RuntimeHooks · WarningEvent · CriticalOutcome · HoleRefusal · PendingShadow · RegionMismatch · RuntimeHookName · WaitingShadow
import { … } from '@ogygia/core/plugin/client';function defineClient(plugin: ClientPlugin): ClientPlugin;AnswerParsedEvent
interface
A region answer (a hole, a lake remount, a live region's tick) was parsed: fragment is inert,
and nothing has read it yet. A subscriber may answer with a promise: nothing reads the fragment
(the region's own copy of its markup, its placement) until it settles.
AnswerParsedEvent.fragment
interface AnswerParsedEvent {/*…*/}readonly fragment: DocumentFragment;AnswerPlacedEvent
interface
A parsed answer went into the page: el is the region it went into.
AnswerPlacedEvent.el
interface AnswerPlacedEvent {/*…*/}readonly el: Element;ClientBootContext
interface
What boot is told about the page.
ClientBootContext.kitPage
A page Kit hydrates (csr = true): ogygia's runtime does not boot there and no region hook fires; the realm boots on its own (dev only).
interface ClientBootContext {/*…*/}readonly kitPage: boolean;ClientPlugin
interface
A plugin's browser half.
ClientPlugin.boot
Once, as the runtime boots: after core's features, before the first region wakes.
ClientPlugin.hooks
The runtime moments this plugin subscribes to.
interface ClientPlugin {/*…*/}boot?(ctx: ClientBootContext): void;hooks?: Partial<RuntimeHooks>;CriticalSettledEvent
interface
The critical-resources wait settled: the region downloads it held back may start.
CriticalSettledEvent.outcome
CriticalSettledEvent.resources
how many critical resources it waited on
CriticalSettledEvent.waitedMs
interface CriticalSettledEvent {/*…*/}readonly outcome: CriticalOutcome;readonly resources: number;readonly waitedMs: number;EntryFallbackEvent
interface
A region whose location failed to load and fell back to its identity fetched fresh.
EntryFallbackEvent.entry
the identity (the stable URL)
EntryFallbackEvent.src
the location that failed
EntryFallbackEvent.recovered
the fresh identity loaded (false: that failed too)
interface EntryFallbackEvent {/*…*/}readonly entry: string;readonly src: string;readonly recovered: boolean;HoleAnsweredEvent
interface
A hole's first answer replaced its fallback. batch: it came in a batch request of size holes that left at left and whose part for this hole landed at.
HoleAnsweredEvent.el
HoleAnsweredEvent.start
HoleAnsweredEvent.batch
interface HoleAnsweredEvent {/*…*/}readonly el: Element;readonly start: number;readonly batch?: {
readonly left: number;
readonly at: number;
readonly size: number;
};HoleBatchMissedEvent
interface
A batch request that carried fewer holes than it was sent for.
HoleBatchMissedEvent.sent
HoleBatchMissedEvent.delivered
HoleBatchMissedEvent.status
HoleBatchMissedEvent.refused
HoleBatchMissedEvent.finalUrl
HoleBatchMissedEvent.endpoints
the holes' endpoints
interface HoleBatchMissedEvent {/*…*/}readonly sent: number;readonly delivered: number;readonly status: number;readonly refused?: "redirected" | "document";readonly finalUrl?: string;readonly endpoints: readonly string[];HoleFailedEvent
interface
A hole whose answer never came (no retry after).
HoleFailedEvent.el
HoleFailedEvent.id
the hole's island id (its endpoint's ?id=)
HoleFailedEvent.reason
HoleFailedEvent.finalPath
what answered instead, as a path (a refused answer)
HoleFailedEvent.message
the error's first line (a failed request), or the server's reason (a refused capability)
HoleFailedEvent.attempts
HoleFailedEvent.t
interface HoleFailedEvent {/*…*/}readonly el: Element;readonly id: string;readonly reason: HoleRefusal | "error";readonly finalPath?: string;readonly message?: string;readonly attempts: number;readonly t: number;LoadStartedEvent
interface
A download ogygia started on its own left the load scheduler's queue: its class, what it fetches, and how long it waited for its slot.
LoadStartedEvent.class
LoadStartedEvent.kind
LoadStartedEvent.label
LoadStartedEvent.waitedMs
interface LoadStartedEvent {/*…*/}readonly class: "user" | "visible" | "ahead" | "speculative";readonly kind: "code" | "content";readonly label?: string;readonly waitedMs: number;NavigatedEvent
interface
An in-app navigation, timed by the router (page time, ms).
NavigatedEvent.from
NavigatedEvent.to
NavigatedEvent.type
NavigatedEvent.t
NavigatedEvent.fetched
NavigatedEvent.styled
NavigatedEvent.swapped
NavigatedEvent.href
the page's address as fetched
NavigatedEvent.reconciled
the regions were reconciled in place (false: the whole body was swapped)
interface NavigatedEvent {/*…*/}readonly from: string;readonly to: string;readonly type: string;readonly t: number;readonly fetched: number;readonly styled: number;readonly swapped: number;readonly href?: string;readonly reconciled: boolean;NavStartedEvent
interface
An in-app navigation started (before the page is fetched or swapped).
NavStartedEvent.from
NavStartedEvent.to
NavStartedEvent.type
interface NavStartedEvent {/*…*/}readonly from: string;readonly to: string;readonly type: string;PageGlobals
interface
The page-wide hooks, each optional: the bundle that sets it may not be on the page.
interface PageGlobals {/*…*/}RegionFailedEvent
interface
A region failed to hydrate.
RegionFailedEvent.el
RegionFailedEvent.message
RegionFailedEvent.since
RegionFailedEvent.turn
interface RegionFailedEvent {/*…*/}readonly el: Element;readonly message: string;readonly since: number;readonly turn?: number;RegionHydratedEvent
interface
A region hydrated: when it woke, when its modules were in hand, when its scheduler turn began
and when data-hydrated was set (page time, ms), with the markup the server sent.
RegionHydratedEvent.el
RegionHydratedEvent.t0
RegionHydratedEvent.tLoaded
RegionHydratedEvent.tTurn
RegionHydratedEvent.tDone
RegionHydratedEvent.ssrHtml
interface RegionHydratedEvent {/*…*/}readonly el: Element;readonly t0: number;readonly tLoaded: number;readonly tTurn?: number;readonly tDone: number;readonly ssrHtml?: string | null;RegionHydrateEvent
interface
Svelte is about to hydrate a component over el's server markup.
RegionHydrateEvent.el
interface RegionHydrateEvent {/*…*/}readonly el: Element;RegionMismatchedEvent
interface
A region's markup was changed between the server and its hydration.
RegionMismatchedEvent.el
RegionMismatchedEvent.kind
RegionMismatchedEvent.reason
the first difference, when the runtime could name it (conflict: the element)
interface RegionMismatchedEvent {/*…*/}readonly el: Element;readonly kind: RegionMismatch;readonly reason?: string;RegionMountEvent
interface
A region's component started in the browser (hydrated, or mounted live).
RegionMountEvent.el
RegionMountEvent.entry
the region's entry (its component's stable module URL)
RegionMountEvent.urls
the files it runs from
interface RegionMountEvent {/*…*/}readonly el: Element;readonly entry: string;readonly urls: readonly string[];RegionUnmountEvent
interface
A region's component left the page.
RegionUnmountEvent.el
RegionUnmountEvent.entry
interface RegionUnmountEvent {/*…*/}readonly el: Element;readonly entry: string;RegionWokeEvent
interface
A region's schedule fired (load, idle, visible, interaction, media): it starts to wake,
or a hole starts to fetch.
RegionWokeEvent.el
RegionWokeEvent.when
interface RegionWokeEvent {/*…*/}readonly el: Element;readonly when: string;ReloadNeededEvent
interface
A chunk that no retry can load: its own file came, yet it still failed, because a static
dependency it imports failed to download and the document keeps that failure for its life (a
dropped connection mid-load). Only a reload loads it. Told once per page, for the first such chunk
(one reload loads them all), where the page says chunk_reload_needed.
ReloadNeededEvent.url
the chunk's URL, as the last retry asked for it
ReloadNeededEvent.error
the error that retry failed with
ReloadNeededEvent.regions
the regions whose own file the chunk is (none for a chunk no region loads directly)
interface ReloadNeededEvent {/*…*/}readonly url: string;readonly error: unknown;readonly regions: readonly Element[];RestoreLogEntry
interface
What the restorer recorded about one host.
RestoreLogEntry.kind
RestoreLogEntry.host
RestoreLogEntry.t
RestoreLogEntry.diff
RestoreLogEntry.key
sheet: the og-shadow key the page carries no sheet for.
RestoreLogEntry.island
interface RestoreLogEntry {/*…*/}kind: "late" | "mismatch" | "sheet" | "invalid";host: string;t: number;diff?: string;key?: string;island?: string;RuntimeHooks
interface
The runtime's moments a plugin's browser half can subscribe to (defineClient({ hooks })).
Every hook is told with an event object of its own (a recorder dedupes by it). A
hook is told; only regionHydrate answers: the function it returns runs right after the hydrate.
RuntimeHooks.regionMount
RuntimeHooks.regionUnmount
RuntimeHooks.regionHydrate
RuntimeHooks.answerParsed
RuntimeHooks.answerPlaced
RuntimeHooks.regionHydrated
RuntimeHooks.regionFailed
RuntimeHooks.regionWoke
RuntimeHooks.regionMismatched
RuntimeHooks.holeAnswered
RuntimeHooks.holeFailed
RuntimeHooks.holeBatchMissed
RuntimeHooks.entryFallback
RuntimeHooks.reloadNeeded
RuntimeHooks.navStarted
RuntimeHooks.navigated
RuntimeHooks.criticalSettled
RuntimeHooks.loadStarted
RuntimeHooks.warning
interface RuntimeHooks {/*…*/}regionMount(e: RegionMountEvent): void;regionUnmount(e: RegionUnmountEvent): void;regionHydrate(e: RegionHydrateEvent): (() => void) | void;answerParsed(e: AnswerParsedEvent): void | Promise<void>;answerPlaced(e: AnswerPlacedEvent): void;regionHydrated(e: RegionHydratedEvent): void;regionFailed(e: RegionFailedEvent): void;regionWoke(e: RegionWokeEvent): void;regionMismatched(e: RegionMismatchedEvent): void;holeAnswered(e: HoleAnsweredEvent): void;holeFailed(e: HoleFailedEvent): void;holeBatchMissed(e: HoleBatchMissedEvent): void;entryFallback(e: EntryFallbackEvent): void;reloadNeeded(e: ReloadNeededEvent): void;navStarted(e: NavStartedEvent): void;navigated(e: NavigatedEvent): void;criticalSettled(e: CriticalSettledEvent): void;loadStarted(e: LoadStartedEvent): void;warning(e: WarningEvent): void;WarningEvent
interface
A Svelte hydration warning (dev): the server and the browser disagreed.
WarningEvent.code
WarningEvent.message
WarningEvent.file
WarningEvent.fp
WarningEvent.t
interface WarningEvent {/*…*/}readonly code: string;readonly message: string;readonly file?: string;readonly fp?: string;readonly t: number;CriticalOutcome
type
How the critical-resources wait ended: they arrived (or failed), the visitor's first input,
the cap, or none were pending.
type CriticalOutcome = "arrived" | "input" | "cap" | "none";HoleRefusal
type
Why a hole's answer was refused: it was redirected, came back as a document, or forbidden.
type HoleRefusal = "redirected" | "document" | "forbidden";type PendingShadow = ShadowRoot & {
__og_pending?: CSSStyleSheet[];
};RegionMismatch
type
How a region's server markup and its live DOM disagreed as it hydrated: Svelte threw the server
DOM away and rendered again (recovered), the runtime put the server markup back (healed), or a
web component's own children were removed so hydration could read the markup (conflict).
type RegionMismatch = "recovered" | "healed" | "conflict";type RuntimeHookName = keyof RuntimeHooks;type WaitingShadow = ShadowRoot & {
__og_out?: number;
};