Skip to content

API

ogygia/app

Replacements for $app/navigation that are safe to use inside islands.

On this page

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.

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

function afterNavigate(fn: AfterNavigateCallback): () => void;

beforeNavigate

function

function beforeNavigate(fn: BeforeNavigateCallback): () => void;

bust_page_cache

function

ogygia/app's bust_page_cache: drop the SPA router's warmed page HTML (after mutations / auth changes). A no-op without the router — there is no page cache.

function bust_page_cache(): void;

disableScrollHandling

function

function disableScrollHandling(): void;

goto

function

function goto(url: string | URL, opts?: {
  replaceState?: boolean;
  external?: boolean;
}): Promise<void>;

invalidate

function

function invalidate(resource?: unknown): Promise<void>;

invalidateAll

function

function invalidateAll(): Promise<void>;

preloadCode

function

function preloadCode(url?: string): Promise<void>;

preloadData

function

function preloadData(url: string | URL): Promise<unknown>;

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 — Response Cache-Control header value.
  • setCookie — True if the response included Set-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;

interface

Resolved navigation target (URL + Kit-shaped stubs for params/route).

AfterNavigateCallback

type

Callback registered with afterNavigate.

type AfterNavigateCallback = (nav: AfterNavigation) => void;

BeforeNavigateCallback

type

Callback registered with beforeNavigate.

type BeforeNavigateCallback = (nav: BeforeNavigation) => void;