Interface: RouterConnection()
API / @xmachines/play-router / index / RouterConnection
Defined in: packages/play-router/src/provider-lifecycle.ts:291
What connectRouter of an adapter returns.
The value is CALLABLE, so const disconnect = connectRouter(…); disconnect(); keeps
working exactly as it did. It also carries the mount API, because a host that gives a
basePath needs the two things MountableRouterBridge promises: the resolved
mount to read back, and a way to move it. The bridge itself lives inside
connectRouter, so without this handle a host had to rebuild the actor and the bridge
to move a mount — which throws away the LRU cache of the route map, the very thing
setBasePath exists to keep.
basePath and basePathParams are GETTERS on the live bridge, so they cannot go
stale.
RouterConnection(): void;Defined in: packages/play-router/src/provider-lifecycle.ts:293
Stops the synchronization. The same call as RouterConnection.disconnect.
Returns
void
Properties
| Property | Modifier | Type | Description | Defined in |
|---|---|---|---|---|
basePath | readonly | string | The resolved prefix of the mount, or "" when the machine owns the whole router. | packages/play-router/src/provider-lifecycle.ts:309 |
basePathParams | readonly | Readonly<Record<string, string>> | The values of the :param segments of the mount. They travel in no event. | packages/play-router/src/provider-lifecycle.ts:311 |
Methods
disconnect()
disconnect(): void;Defined in: packages/play-router/src/provider-lifecycle.ts:307
Stops the synchronization. It is idempotent.
A scope can own the connection: the connection is its own release, so
asDisposable of @xmachines/core/utils publishes it with no second argument.
{ using connection = asDisposable(connectRouter({ actor, router, routeMap })); // disconnect() runs at the end of the scope, and after an exception too}Returns
void
setBasePath()
setBasePath(basePath?, basePathParams?): void;Defined in: packages/play-router/src/provider-lifecycle.ts:313
Moves the mount of the live bridge, with no teardown.
Parameters
| Parameter | Type |
|---|---|
basePath? | string |
basePathParams? | Record<string, string | number> |
Returns
void