API
ogygia/app
Island-safe $app/navigation replacements.
On this page
- afterNavigate
- beforeNavigate
- bust_page_cache
- disableScrollHandling
- goto
- invalidate
- invalidateAll
- preloadCode
- preloadData
- spa_html_cacheable
- AfterNavigation
- AfterNavigation.from
- AfterNavigation.to
- AfterNavigation.type
- AfterNavigation.willUnload
- BeforeNavigation
- BeforeNavigation.from
- BeforeNavigation.to
- BeforeNavigation.type
- BeforeNavigation.cancel
- BeforeNavigation.willUnload
- NavTarget
- NavTarget.url
- NavTarget.params
- NavTarget.route
- AfterNavigateCallback
- BeforeNavigateCallback
Auto-generated from the package’s own .d.ts on every build — signatures, JSDoc, and examples straight from the source.
import { … } from 'ogygia/app';Exports afterNavigate · beforeNavigate · bust_page_cache · disableScrollHandling · goto · invalidate · invalidateAll · preloadCode · preloadData · spa_html_cacheable · AfterNavigation · BeforeNavigation · NavTarget · AfterNavigateCallback · BeforeNavigateCallback
afterNavigate
function
Register a callback after a successful client-side navigation. Returns an unsubscribe function.
function afterNavigate(fn: AfterNavigateCallback): () => boolean;beforeNavigate
function
Register a callback before a client-side navigation.
Call nav.cancel() to abort. Returns an unsubscribe function.
function beforeNavigate(fn: BeforeNavigateCallback): () => boolean;bust_page_cache
function
Drop all warmed page HTML (call after mutations / auth changes).
function bust_page_cache(): void;disableScrollHandling
function
Skip scroll restoration / scroll-to-top on the next client-side navigation.
function disableScrollHandling(): void;goto
function
Programmatic same-origin navigation. Mirrors Kit's goto() subset.
function goto(url: string | URL, opts?: {
replaceState?: boolean;
}): Promise<void>;url— Absolute or relative URL (http(s) only).opts.replaceState— Replace the current history entry instead of pushing.
invalidate
function
Refresh navigation data. Without Kit's client we cannot invalidate a single
dependency, so this refreshes everything (same as invalidateAll).
function invalidate(): Promise<void>;invalidateAll
function
Soft-refresh the current URL's document seeds + head (not a navigation). Busts the SPA HTML cache so the next real route change is fresh. Coarser than Kit's dependency-scoped invalidate — see {@link SpaRouter.invalidateAll }.
function invalidateAll(): Promise<void>;preloadCode
function
Router ON: no-op — page “code” arrives with the HTML body swap (+ island chunks on connect). Router OFF: hint a native Speculation Rules PREFETCH for the URL (the code-only speculation leg — Firefox supports it; a prerender-capable browser treats prefetch as prerender's first stage).
function preloadCode(url?: string | URL): Promise<void>;preloadData
function
Warm the next page. Router ON (SPA): fetch the page into the swap-readable HTML cache (+ its
island modules) — this is what makes the eventual click instant, and no browser cache can feed a
body swap. Router OFF (MPA, this module reached via the $app/navigation shim / ogygia/app):
the browser owns navigation, so hint a native Speculation Rules PRERENDER for the URL — Chromium
activates it on the real navigation; unsupporting browsers silently ignore it.
function preloadData(url: string | URL): Promise<{
type: string;
status: number;
data: {};
}>;spa_html_cacheable
function
Whether a fetch response may warm the SPA page-HTML cache.
function spa_html_cacheable(cacheControl: string, setCookie: boolean): boolean;cacheControl— ResponseCache-Controlheader value.setCookie— True if the response includedSet-Cookie.
Returns False when the response is private / no-store / no-cache or set a cookie.
AfterNavigation
interface
Payload for afterNavigate callbacks.
interface AfterNavigation {/*…*/}AfterNavigation.from
from: NavTarget | null;AfterNavigation.to
to: NavTarget;AfterNavigation.type
type: string;AfterNavigation.willUnload
willUnload: boolean;BeforeNavigation
interface
Payload for beforeNavigate callbacks.
interface BeforeNavigation {/*…*/}BeforeNavigation.from
from: NavTarget;BeforeNavigation.to
to: NavTarget;BeforeNavigation.type
type: string;BeforeNavigation.cancel
cancel: () => void;BeforeNavigation.willUnload
willUnload: boolean;NavTarget
interface
Resolved navigation target (URL + Kit-shaped stubs for params/route).
interface NavTarget {/*…*/}NavTarget.url
url: URL;NavTarget.params
params: Record<string, string>;NavTarget.route
route: {
id: string | null;
};AfterNavigateCallback
type
Callback registered with afterNavigate.
type AfterNavigateCallback = (nav: AfterNavigation) => void;BeforeNavigateCallback
type
Callback registered with beforeNavigate.
type BeforeNavigateCallback = (nav: BeforeNavigation) => void;