@jsvision/ui / Route
Interface: Route<P>
Defined in: ui/src/router/types.ts:139
A route definition: how to build the screen for a set of params, plus optional keep-alive, focus, and (de)serialization behavior.
Example
const detail: Route<{ id: number }> = {
build: (ctx) => ({ view: new DetailScreen(ctx.params.id) }),
keepAlive: false,
serialize: (p) => `id=${p.id}`,
parse: (s) => ({ id: Number(new URLSearchParams(s).get('id')) }),
};Type Parameters
P
P
Properties
build
build: (
ctx) =>ScreenBundle
Defined in: ui/src/router/types.ts:141
Build this route's screen bundle for the given params. Called on each activation unless kept alive.
Parameters
ctx
RouteContext<P>
Returns
focusKey?
optionalfocusKey?: (view) =>string
Defined in: ui/src/router/types.ts:145
Optional exact-restore key: derive a stable key from the focused view so focus survives a rebuild.
Parameters
view
Returns
string
keepAlive?
optionalkeepAlive?:boolean
Defined in: ui/src/router/types.ts:143
Keep the screen mounted-but-hidden when navigating away, so its state survives a round-trip. Default off.
parse?
optionalparse?: (s) =>P
Defined in: ui/src/router/types.ts:149
Optional codec: parse this route's params back from a string.
Parameters
s
string
Returns
P
serialize?
optionalserialize?: (params) =>string
Defined in: ui/src/router/types.ts:147
Optional codec: serialize this route's params to a string (designed for deep-linking).
Parameters
params
P
Returns
string