Skip to content
Meeko
Type to search the guides and the API reference. Open it from any page with / or Ctrl K; move with the arrow keys and open a result with Enter.
Get started

Contents

On this page

Not translated yet

This page has not been translated into English yet, so it is shown in Spanish.

NavigationContext

interfaz

Lo que recibe el callback de render de createNavigator en cada navegación.

ts
import type { NavigationContext } from "@meekojs/meeko/framework";

Source code src/app/runtime/router.ts:343

Declaración #

ts
interface NavigationContext {
	readonly viewTransition?: boolean
	readonly url: URL
	readonly match: RouteMatch
	readonly signal: AbortSignal
	readonly retainedLayouts: number
}

Example #

ts
import { createNavigator } from "@meekojs/meeko/framework";
import type { NavigationContext } from "@meekojs/meeko/framework";

async function render({ url, match, signal, retainedLayouts }: NavigationContext): Promise<boolean> {
  const response = await fetch(url, { signal, headers: { accept: "application/meeko+json" } });
  if (signal.aborted) return false;
  console.log(match.route.id, retainedLayouts, await response.json());
  return true;
}
const navigator = createNavigator(routes, render);

Propiedades #

viewTransition #

propiedad sólo lectura opcional

readonly viewTransition?: boolean

Sobrescribe la opción global de View Transitions para esta navegación.

url #

propiedad sólo lectura

readonly url: URL

URL de destino.

match #

propiedad sólo lectura

readonly match: RouteMatch

Ruta de destino y sus parámetros.

signal #

propiedad sólo lectura

readonly signal: AbortSignal

Se aborta cuando otra navegación sustituye a esta.

retainedLayouts #

propiedad sólo lectura

readonly retainedLayouts: number

Longitud del prefijo común con la cadena de layouts de la ruta anterior, que se conserva.

See also #

Was this page helpful?

Add a comment

It is sent when you choose “Yes” or “No”. Only the page, your answer and the comment are stored: no cookies and no personal data.

0 of 2000 characters

Edit on GitHub: packages/meeko/src/app/runtime/router.ts