Skip to content

Interface: VanillaRouter<History>

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

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

The router that createRouter builds.

The type parameter carries the history of the CALLER. createBrowserHistory gives a DisposableBrowserHistory back, and a bare VanillaRouter would widen it to BrowserHistory — so using stop = router.history.subscribe(fn) would refuse to compile through the very path the README documents. A test double that hands a plain function back stays a plain BrowserHistory, because the parameter says what it says.

The default keeps VanillaRouter usable with no argument, which is what connect-router.ts writes.

Extended by

Type Parameters

Type ParameterDefault type
History extends BrowserHistoryBrowserHistory

Properties

PropertyModifierTypeDescriptionDefined in
historyreadonlyHistoryThe history instanceplay-dom-router/src/create-router.ts:21
routeTreereadonlyRouteTreeThe route tree, as a reference to the structureplay-dom-router/src/create-router.ts:26

Methods

destroy()

destroy(): void;

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

Cleans up

Returns

void