Skip to content

Interface: RouteTree

API / @xmachines/play-router / RouteTree

Defined in: types.ts:122

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

Properties

PropertyTypeDescriptionDefined in
byPathMap<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 eventtypes.ts:134
byStateIdMap<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 URLtypes.ts:129
graph?Graph<MachineNodeData, MachineEdgeData, any, any>The graph of the state machine, for an advanced query. extractMachineRoutes() fills it. Use it for a query of the hierarchy, for a test of the reachability, and for a navigation that knows the transitions, through the algorithms of @statelyai/graph. Example import { getSuccessors, hasPath } from "@statelyai/graph"; const successors = getSuccessors(tree.graph!, "myMachine.home");types.ts:147
rootRouteNodeThe root node of the routestypes.ts:124