# @askrjs/askr/boot

> Published API exports for @askrjs/askr/boot.

Source: [https://askrjs.com/docs/reference/api/askr/boot](https://askrjs.com/docs/reference/api/askr/boot)

Status: stable. Packages: @askrjs/askr/boot.

**Published packages are authoritative.** Examples may lag behind a published contract. When guidance differs, verify the exports and TypeScript declarations in your installed package, then file an issue.

## Exports

This entrypoint publishes 10 exports from the declarations shipped by @askrjs/askr.

### `cleanupApp`

```ts
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.

### `createIsland`

```ts
createIsland: (config: IslandConfig) => void
```

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

### `createIslands`

```ts
createIslands: (config: IslandsConfig) => void
```

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

### `createSPA`

```ts
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 });
```

### `hasApp`

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

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

### `hydrateSPA`

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

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

### `HydrateSPAConfig`

```ts
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}.

### `IslandConfig`

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

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

### `IslandsConfig`

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

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

### `SPAConfig`

```ts
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}.

## Documentation navigation

[Previous](https://askrjs.com/docs/reference/api/askr/root/index.md) | [Next](https://askrjs.com/docs/reference/api/askr/components/index.md)
