0.3.0 • Published 6 years ago

rootr v0.3.0

Weekly downloads
17
License
MIT
Repository
github
Last release
6 years ago

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') )
}])
0.3.0

6 years ago

0.2.4

6 years ago

0.2.3

6 years ago

0.2.2

6 years ago

0.2.1

6 years ago

0.2.0

6 years ago

0.1.3

6 years ago

0.1.2

6 years ago

0.1.1

6 years ago

0.1.0

6 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago