Askr documentation
Generated API snapshot

@askrjs/askr/boot

Exports from the declarations published in @askrjs/askr. Signatures reflect the published artifact.

Exports

This entrypoint publishes 10 exports. Use the anchored symbol rows for direct links. Type-only exports are labeled separately from runtime values.

cleanupApptype

cleanupApp: (root: Element | string) => void

Tear down the app mounted at `root`: runs its cleanup callbacks, clears route state if it was the last routed root, and removes bookkeeping for the root element.

createIslandtype

createIsland: (config: IslandConfig) => void

createIsland: Enhances existing DOM (no router, mounts once)

createIslandstype

createIslands: (config: IslandsConfig) => void

createIslands: Enhances one or more existing DOM roots (no router). The only public islands constructor.

createSPAtype

createSPA: (config: SPAConfig) => Promise<void>

createSPA: Initializes the router and mounts the app with an explicit route registry. ```ts import { createRouteRegistry } from '@askrjs/askr/router'; const registry = createRouteRegistry(() => { ... }); await createSPA({ root: '#app', registry }); ```

hasApptype

hasApp: (root: Element | string) => boolean

Check whether an app instance is currently mounted at `root`.

hydrateSPAtype

hydrateSPA: (config: HydrateSPAConfig) => Promise<void>

hydrateSPA: Hydrate server-rendered HTML with an explicit route registry.

HydrateSPAConfigtype

HydrateSPAConfig: BootRouteSource & {
  root: Element | string;
  cspNonce?: string;
  dataRuntime?: DataRuntime;
  /** Pass the same explicit route registry used for the server render. */
  auth?: RouteAuthOptions;
  scrollRestoration?: boolean | ScrollRestorationOptions;
  cleanupStrict?: boolean;
  hydrate?: {
    verifyMarkup?: boolean;
    deferUntilIdle?: boolean;
    deferBelowFold?: boolean;
    foldThreshold?: number;
    skipSelectors?: string[];
  };
}

Configuration for {@link hydrateSPA}.

IslandConfigtype

IslandConfig: {
  root: Element | string;
  component: ComponentFunction;
  cspNonce?: string;
  cleanupStrict?: boolean;
  routes?: never;
}

Configuration for {@link createIsland}: mounts one component onto existing DOM.

IslandsConfigtype

IslandsConfig: {
  islands: IslandConfig[];
  cspNonce?: string;
}

Configuration for {@link createIslands}: mounts several islands at once.

SPAConfigtype

SPAConfig: BootRouteSource & {
  root: Element | string;
  cspNonce?: string;
  /** Optional data runtime, primarily for routed test fixtures. */
  dataRuntime?: DataRuntime;
  /** Pass a route registry built via `createRouteRegistry(() => { ... })`. */
  auth?: RouteAuthOptions;
  scrollRestoration?: boolean | ScrollRestorationOptions;
  cleanupStrict?: boolean;
  component?: never;
}

Configuration for {@link createSPA}.