# Class Router<T>

#### See

https://github.com/nombrekeff/cardboard-js/wiki/Routing

#### Type Parameters

- #### T extends Record<string, Route> = Record<string, Route>

#### Hierarchy

- Router

- Defined in ext/routing.ts:27

#####
Index

### Constructors

constructor

### Properties

_currentRoute?
_currentTag?
_history
_location
_options
_rootParent
_routeMatchers
_routes
_window
params
query

### Accessors

currentRoute

### Methods

_getEffectiveRoute
_getRoute
_hookLifecycle
_initRouteMatchers
_listenEvents
_modifyPushState
_setCurrentRoute
_setRoute
navigate

## Constructors

### constructor

- new Router<T>(options): Router<T>

- #### Type Parameters

  - #### T extends Record<string, Route> = Record<string, Route>

  #### Parameters

  - ##### options: RouterOptions<T>

  #### Returns Router<T>

  - Defined in ext/routing.ts:48

## Properties

### `Private` `Optional` _currentRoute

_currentRoute?: string

- Defined in ext/routing.ts:33

### `Private` `Optional` _currentTag

_currentTag?: CTag

- Defined in ext/routing.ts:34

### `Private` `Readonly` _history

_history: History

- Defined in ext/routing.ts:32

### `Private` `Readonly` _location

_location: Location

- Defined in ext/routing.ts:31

### `Private` `Readonly` _options

_options: RouterOptions<T>

- Defined in ext/routing.ts:28

### `Private` `Readonly` _rootParent

_rootParent: CTag

- Defined in ext/routing.ts:35

### `Private` `Readonly` _routeMatchers

_routeMatchers: {
key: string;
matcher: RouteMatcher;
}[] = []

#### Type declaration

- ##### key: string

- ##### matcher: RouteMatcher

- Defined in ext/routing.ts:36

### `Private` _routes

_routes: Record<string, CTag> = {}

- Defined in ext/routing.ts:29

### `Private` `Readonly` _window

_window: Window & typeof globalThis

- Defined in ext/routing.ts:30

### params

params: Record<string, string> = {}

- Defined in ext/routing.ts:41

### query

query: URLSearchParams = ...

- Defined in ext/routing.ts:42

## Accessors

### currentRoute

- get currentRoute(): undefined | string

- #### Returns undefined | string

  - Defined in ext/routing.ts:44

## Methods

### `Private` _getEffectiveRoute

- _getEffectiveRoute(): undefined | string

- #### Returns undefined | string

  - Defined in ext/routing.ts:107

### `Private` _getRoute

- _getRoute(): CTag

- #### Returns CTag

  - Defined in ext/routing.ts:129

### `Private` _hookLifecycle

- _hookLifecycle(route): void

- #### Parameters

  - ##### route: CTag

  #### Returns void

  - Defined in ext/routing.ts:99

### `Private` _initRouteMatchers

- _initRouteMatchers(): void

- #### Returns void

  - Defined in ext/routing.ts:194

### `Private` _listenEvents

- _listenEvents(): void

- #### Returns void

  - Defined in ext/routing.ts:178

### `Private` _modifyPushState

- _modifyPushState(): void

- #### Returns void

  - Defined in ext/routing.ts:186

### `Private` _setCurrentRoute

- _setCurrentRoute(): void

- #### Returns void

  - Defined in ext/routing.ts:172

### `Private` _setRoute

- _setRoute(): Promise<void>

- #### Returns Promise<void>

  - Defined in ext/routing.ts:81

### navigate

- navigate(route, query?): void

- Navigate to a route with optional query parameters.

  #### Parameters

  - ##### route: string

  - ##### `Optional` query: Record<string, string>

  #### Returns void

  #### See

  https://github.com/nombrekeff/cardboard-js/wiki/Routing

  - Defined in ext/routing.ts:66

Generated using TypeDoc