Abstract Class: RouterBridgeBase
API / @xmachines/play-router / RouterBridgeBase
Defined in: router-bridge-base.ts:96
Abstract base class for all @xmachines router adapter bridges.
Implements RouterBridge protocol and contains all common bridge logic. Subclasses only need to implement the 3 abstract methods that differ between frameworks.
Extended by
ReactRouterBridgeTanStackRouterBridgeBaseSolidRouterBridgeTanStackReactRouterBridgeVueRouterBridge
Implements
Constructors
Constructor
new RouterBridgeBase(actor, routeMap): RouterBridgeBase;Defined in: router-bridge-base.ts:123
Parameters
| Parameter | Type | Description |
|---|---|---|
actor | RoutableActor | A RoutableActor exposing currentRoute, initialRoute, and send. |
routeMap | { getPathByStateId: string | null | undefined; getStateIdByPath: string | null | undefined; } | Bidirectional route map for stateId ↔ path resolution. Provide getStateIdByPath and getPathByStateId. Framework adapters typically wrap the result of createRouteMap(machine) or an equivalent. getPathByStateId may be keyed on either the "#stateId" or the bare "stateId" form — both forms are tried automatically by the bridge, so custom implementations (e.g. plain test objects) need only handle one. |
routeMap.getPathByStateId | - | |
routeMap.getStateIdByPath | - |
Returns
RouterBridgeBase
Methods
connect()
connect(): void;Defined in: router-bridge-base.ts:151
Connect the router bridge to the Actor.
Sets up the TC39 Signal watcher for actor → router direction and starts watching router changes (framework-specific).
Ordering here is part of the bridge contract:
lastSyncedPathis seeded in the constructor fromactor.currentRoute- the actor watcher is installed before adapter router subscriptions
- initial sync then resolves deep-link vs restore using
actor.initialRoute
Adapters that need custom initial-sync behavior should override
getInitialRouterPath() rather than reordering connect() steps.
Returns
void
Implementation of
disconnect()
disconnect(): void;Defined in: router-bridge-base.ts:256
Disconnect the router bridge from the Actor.
Stops signal watching and unregisters framework-specific router listener.
Returns
void