Interface: RouterConnection()
API / @xmachines/play-router / index / RouterConnection
Defined in: packages/play-router/src/provider-lifecycle.ts:292
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:294
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:315 |
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:317 |
Methods
[dispose]()
dispose: void;Defined in: packages/play-router/src/provider-lifecycle.ts:313
Stops the synchronization when the scope of a using declaration ends.
This value IS the release of connectRouter, and all eight router adapters return
it, so it carries the protocol of @xmachines/play like every other release of the
ecosystem:
{ using connection = connectRouter({ actor, router, routeMap }); // disconnect() runs at the end of the scope, and after an exception too}The release is RouterConnection.disconnect, which is idempotent.
Returns
void
disconnect()
disconnect(): void;Defined in: packages/play-router/src/provider-lifecycle.ts:296
Stops the synchronization.
Returns
void
setBasePath()
setBasePath(basePath?, basePathParams?): void;Defined in: packages/play-router/src/provider-lifecycle.ts:319
Moves the mount of the live bridge, with no teardown.
Parameters
| Parameter | Type |
|---|---|
basePath? | string |
basePathParams? | Record<string, string | number> |
Returns
void