# Class: Router

## routing~Router()

A bare-bones history-api based SPA router.

## Constructor

#### new Router()

Initialize the router and determine the current page.

Source:
  - frontend/src/module/routing.js, line 29

### Members

#### base_path

Returns the APP_BASE_PATH of the application.

Source:
  - frontend/src/module/routing.js, line 44

#### current_route

The currently navigated route.

Source:
  - frontend/src/module/routing.js, line 14

#### history :Array.<object>

Array of router history records.

##### Type:

- Array.<object>

Source:
  - frontend/src/module/routing.js, line 26

#### route_args :undefined|*

Arguments for the current route.

##### Type:

- undefined | *

Source:
  - frontend/src/module/routing.js, line 11

#### subscribers :Array.<function()>

List of callback functions listening for route changes.

##### Type:

- Array.<function()>

Source:
  - frontend/src/module/routing.js, line 20

### Methods

#### back()

Navigate back one route.

Source:
  - frontend/src/module/routing.js, line 64

#### build_url(…parts) → {string}

Given an array of route parts, build a joined URL route.

##### Parameters:

Name | Type | Attributes | Description
--- | --- | --- | ---
`parts` | string | <repeatable> |

Source:
  - frontend/src/module/routing.js, line 94

##### Returns:

Type
  string

#### navigate(path, args)

Navigate the app to the given path with the given args.

##### Parameters:

Name | Type | Description
--- | --- | ---
`path` | string |
`args` | * |

Source:
  - frontend/src/module/routing.js, line 53

#### subscribe(handler) → {object}

Subscribe to listen for route changes. Returns an object with an unsubscribe() property.

##### Parameters:

Name | Type | Description
--- | --- | ---
`handler` | function | callback called when the route changes

Source:
  - frontend/src/module/routing.js, line 77

##### Returns:

- subscription manager

Type
  object