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

router5/xstream-router5

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version

xstream-router5

xstream integration with router5

npm install --save xstream-router5

Usage

xstream-router5 exports a single function createObservables:

import createRouter from 'router5';
import createObservables from 'xstream-router5';

const router = createRouter([
    { name: 'home', path: '/home' },
    { name: 'about', path: '/about' }
]);

const {
    route$,
    routeNode,
    transitionError$,
    transitionRoute$
} = createObservables(router)

router.start();

route$.map((route) => { /* ... */ })

Available observables

createObservables returns the following observables:

  • route$: an observable of your application route
  • transitionRoute$: an observable of the currently transitioning route
  • transitionError$: an observable of transition errors
  • routeNode(nodeName = ''): a function returning an observable of route updates for the specified node. See understanding router5.

Related

About

xstream plugin for router5 [MOVED]

Resources

License

Stars

Watchers

Forks

Packages

No packages published