Skip to content

Interface: VanillaRouter

API / @xmachines/play-dom-router / VanillaRouter

Defined in: play-dom-router/src/create-router.ts:24

The router that createRouter builds and returns.

The router wraps a BrowserHistory and a RouteTree, and it does nothing more. It OWNS the history, and the history patches window.history.pushState, so a scope that drops the router without releasing it leaves the global patched. The dispose key lets a scope do that work:

using router = createRouter({ routeTree, history });

The release covers the HISTORY alone, exactly as destroy() always did. connectRouter hands back its own RouterConnection, and a scope that ends releases no connection for the caller: release the connection first, then the router.

A caller that keeps destroy() keeps it: the two release the same work, and the release is idempotent because BrowserHistory.destroy is.

Properties

PropertyModifierTypeDescriptionDefined in
historyreadonlyBrowserHistoryThe history instanceplay-dom-router/src/create-router.ts:28
routeTreereadonlyRouteTreeThe route tree, as a reference to the structureplay-dom-router/src/create-router.ts:33

Methods

[dispose]()

dispose: void;

Defined in: play-dom-router/src/create-router.ts:41

Releases the history with VanillaRouter.destroy. It is idempotent.

Returns

void


destroy()

destroy(): void;

Defined in: play-dom-router/src/create-router.ts:38

Cleans up

Returns

void