Class: RouteMap
Documentation / @xmachines/play-vue-router / RouteMap
Defined in: play-vue-router/src/route-map.ts:14
VueBaseRouteMap — intermediate base class for Vue Router adapters.
Extends BaseRouteMap (bucket-indexed O(k) pattern matching + QuickLRU 500-entry
cache) and adds the Vue-specific adapter layer: routeName ↔ stateId bidirectional
lookup and optional URL pattern access.
Why a separate base class? Vue Router uses named routes (routeName) rather than
URL paths for navigation. BaseRouteMap operates on path strings; VueBaseRouteMap
bridges the two by translating RouteMapping entries at construction time — only
mappings with a pattern field participate in URL path resolution via BaseRouteMap.
Exported from @xmachines/play-vue-router for consumers who need to extend or test
the Vue routing layer directly. Most consumers use RouteMap instead.
Example
import { VueBaseRouteMap } from "@xmachines/play-vue-router";
class MyVueRouteMap extends VueBaseRouteMap { // add custom resolution logic}Extends
Constructors
Constructor
new RouteMap(mappings): RouteMap;Defined in: play-vue-router/src/vue-base-route-map.ts:32
Parameters
| Parameter | Type |
|---|---|
mappings | RouteMapping[] |
Returns
RouteMap
Inherited from
Methods
getPathByStateId()
getPathByStateId(stateId): string | null;Defined in: play-router/dist/base-route-map.d.ts:111
Look up the path pattern registered for a state ID.
Parameters
| Parameter | Type | Description |
|---|---|---|
stateId | string | State machine state ID (e.g., "profile", "#settings") |
Returns
string | null
The registered path pattern, or null if the state ID is unknown
Example
map.getPathByStateId("profile"); // "/profile/:userId"map.getPathByStateId("missing"); // nullInherited from
VueBaseRouteMap.getPathByStateId
getPattern()
getPattern(stateId): string | undefined;Defined in: play-vue-router/src/vue-base-route-map.ts:58
Get the URL path pattern for a given state ID (e.g. "/profile/:userId").
Parameters
| Parameter | Type |
|---|---|
stateId | string |
Returns
string | undefined
Inherited from
getRouteName()
getRouteName(stateId): string | undefined;Defined in: play-vue-router/src/vue-base-route-map.ts:48
Get the Vue Router route name for a given state ID.
Parameters
| Parameter | Type |
|---|---|
stateId | string |
Returns
string | undefined
Inherited from
getStateId()
getStateId(routeName): string | undefined;Defined in: play-vue-router/src/vue-base-route-map.ts:53
Get the state ID for a given Vue Router route name.
Parameters
| Parameter | Type |
|---|---|
routeName | string |
Returns
string | undefined
Inherited from
getStateIdByPath()
getStateIdByPath(path): string | null;Defined in: play-router/dist/base-route-map.d.ts:98
Resolve a URL path to its mapped state ID.
Strips query strings and hash fragments before matching. Tries an O(1) exact lookup first, then falls back to bucket-indexed pattern matching. Results are cached after the first pattern match.
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | URL pathname, optionally including query/hash (e.g., "/profile/123?ref=nav") |
Returns
string | null
The mapped state ID, or null if no route matches
Example
map.getStateIdByPath("/profile/123"); // "profile"map.getStateIdByPath("/unknown"); // null