Registers a route into the RouteStore.

 * addRoute(fromPattern: string, toPattern: string, transition: string): void
taxi.addRoute('/blog/.*', '/', 'blogToHome')

Perform a manual navigation to the provided URL.

If a transition name is not provided then Taxi will try and find a match in the RouteStore, otherwise the default transition will be used.

 * navigateTo(url: string, transition?: string = false): Promise

taxi.navigateTo('/contact', 'explcitTransition').then(() => { ... })


Prefetch the provided URL and add it to the cache ahead of any user navigation.

 * preload( url: string, preloadAssets?: boolean = false): Promise

You can pass a second argument to indicate you want to preload the assets on the target URL as well (images, media, etc):

taxi.preload('/path/to/preload', true)

As preload returns a promise, you can also run code based on whether the fetch was a success or not:

    .then(() => console.log('success!'))
    .catch(err => console.warn(err))


Updates the cached HTML for the provided URL. If no URL is provided, update cache for the current URL.

Useful when adding/removing content via AJAX such as a search page or infinite scroll.

 * updateCache(url?: string): void


Remove the cached HTML for the provided URL. If no URL is provided, remove cache for the current URL.

 * clearCache(url?: string): void


If you don't like "default" as the name of your default renderer, you can change the default renderer to be anything you like here.

 * setDefaultRenderer(renderer: string): void


Same as setDefaultRenderer, but for the transitions instead.

 * setDefaultTransition(transition: string): void


Events are handled by @unseenco/e.

Adding Listeners

import { Core } from '@unseenco/taxi'

const taxi = new Core({ ... })

// This event is sent everytime a `data-taxi-view` is added to the DOM
taxi.on('NAVIGATE_IN', ({ to, trigger }) => {
  // ...

// This event is sent before the `onLeave()` method of a transition is run to hide a `data-router-view`
taxi.on('NAVIGATE_OUT', ({ from, trigger }) => {
  // ...

// This event is sent everytime the `done()` method is called in the `onEnter()` method of a transition
taxi.on('NAVIGATE_END', ({ to, from, trigger }) => {
  // ...

Removing Listeners

You can call taxi.off(event_name) to remove all listeners for an event, or pass the callback to remove just that listener instead:

function foo() {

taxi.on('NAVIGATE_OUT', foo)

// Remove just the foo listener
taxi.off('NAVIGATE_OUT', foo)

// Remove all listeners