Interface: RouteTree<TGraph>
API / @xmachines/play-router / index / RouteTree
Defined in: packages/play-router/src/types.ts:218
The complete route tree, with its lookup maps
It gives you the map between a state ID and a URL path, in both directions:
- byStateId: it maps each state ID to its route node, for the target of a play.route event
- byPath: it maps each URL path to its route node, for the browser navigation
Type Parameters
| Type Parameter | Default type |
|---|---|
TGraph | unknown |
Properties
| Property | Type | Description | Defined in |
|---|---|---|---|
byPath | Map<string, RouteNode> | The map from a complete path to its route node. It gives you the state ID of a URL path, for the target of a play.route event | packages/play-router/src/types.ts:230 |
byStateId | Map<string, RouteNode> | The map from a state ID to its route node. It gives you the URL path of a state ID, for the update of the browser URL | packages/play-router/src/types.ts:225 |
graph? | TGraph | The graph of the state machine, for an advanced query. TGraph carries its type, and this package names none: a route tree is a map from a path to a state, and the graph of a MACHINE belongs to the package that reads a machine. extractMachineRoutes of @xmachines/play-router/xstate answers RouteTree<MachineGraph>, so a consumer of that function loses no type. Example import { getSuccessors, hasPath } from "@statelyai/graph"; // treecomes fromextractMachineRoutesof@xmachines/play-router/xstate const successors = getSuccessors(tree.graph!, "myMachine.home"); | packages/play-router/src/types.ts:246 |
root | RouteNode | The root node of the routes | packages/play-router/src/types.ts:220 |