Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Router

A Router instance manages all navigation and data loading/mutations

interface Router {
_internalActiveDeferreds: Map<string, DeferredData>;
_internalFetchControllers: Map<string, AbortController>;
get basename(): RouterInit["basename"];
createHref(location: Location | URL): string;
deleteFetcher(key?: string): void;
dispose(): void;
enableScrollRestoration(
savedScrollPositions: Record<string, number>,
getScrollPosition: GetScrollPositionFunction,
): () => void;
encodeLocation(to: To): Path;
fetch(
key: string,
routeId: string,
href: string,
): void;
getFetcher<TData = any>(key?: string): Fetcher<TData>;
initialize(): Router;
navigate(to: number): void;
navigate(to: To, opts?: RouterNavigateOptions): void;
revalidate(): void;
get routes(): AgnosticDataRouteObject[];
get state(): RouterState;
subscribe(fn: RouterSubscriber): () => void;
}

§Properties

§
_internalActiveDeferreds: Map<string, DeferredData>
[src]
§
_internalFetchControllers: Map<string, AbortController>
[src]

§Methods

§
get basename(): RouterInit["basename"]
[src]
§
createHref(location: Location | URL): string
[src]
@param location
§
deleteFetcher(key?: string): void
[src]
@param key
§
dispose(): void
[src]
§
enableScrollRestoration(
savedScrollPositions: Record<string, number>,
getScrollPosition: GetScrollPositionFunction,
): () => void
[src]
@param savedScrollPositions

Object that will manage positions, in case it's being restored from sessionStorage

@param getScrollPosition

Function to get the active Y scroll position

@param getKey

Function to get the key to use for restoration

§
encodeLocation(to: To): Path
[src]
@param to
§
fetch(
key: string,
routeId: string,
href: string,
): void
[src]
@param key

Fetcher key

@param routeId

Route that owns the fetcher

@param href

href to fetch

@param opts

Fetcher options, (method, submission, etc.)

§
getFetcher<TData = any>(key?: string): Fetcher<TData>
[src]
@param key
§
initialize(): Router
[src]
§
revalidate(): void
[src]
§
get state(): RouterState
[src]
§
subscribe(fn: RouterSubscriber): () => void
[src]
@param fn

function to call with the new state