Skip to content

Interface: RouterConnection()

API / @xmachines/play-svelte-spa-router / RouterConnection

Defined in: play-router/src/provider-lifecycle.ts:275

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: play-router/src/provider-lifecycle.ts:277

Stops the synchronization. The same call as RouterConnection.disconnect.

Returns

void

Properties

PropertyModifierTypeDescriptionDefined in
basePathreadonlystringThe resolved prefix of the mount, or "" when the machine owns the whole router.play-router/src/provider-lifecycle.ts:298
basePathParamsreadonlyReadonly<Record<string, string>>The values of the :param segments of the mount. They travel in no event.play-router/src/provider-lifecycle.ts:300

Methods

[dispose]()

dispose: void;

Defined in: play-router/src/provider-lifecycle.ts:296

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: play-router/src/provider-lifecycle.ts:279

Stops the synchronization.

Returns

void


setBasePath()

setBasePath(basePath?, basePathParams?): void;

Defined in: play-router/src/provider-lifecycle.ts:302

Moves the mount of the live bridge, with no teardown.

Parameters

ParameterType
basePath?string
basePathParams?Record<string, string | number>

Returns

void