Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

jcfisher007/rootr

Repository files navigation

rootr

CircleCI

Overview

A router for single page apps:

  1. Wraps DOM APIs for window and history.
  2. Routes defined with paths, similar to express.
  3. Content loaded async. Works with code splitting.

Usage

Setup

var {loadContent, loadRoutes} = require('rootr')

let routes = [{
    path: '/',
    load: () => System.import('./pages/home')
  } {
    path: '*',
    load: () => System.import('./pages/error_not_found')
  }]

loadRoutes( routes )

Open path programmically

import {location} from 'rootr'
location.open('/buckets/1')

Use redirect to change the URL without adding an entry to the history state.

location.redirect('/buckets')

Replace routes

Change the routes.

loadRoutes([{
  path: '/',
  load: loadContent( System.import('./pages/home') )
}])

About

Single page app router based on history API, builds on fluxury.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published