rxjs-router5

RxJS plugin for router5

Usage no npm install needed!

<script type="module">
  import rxjsRouter5 from 'https://cdn.skypack.dev/rxjs-router5';
</script>

README

npm version

rxjs-router5

rxjs (RxJS 5+) integration with router5

npm install --save rxjs-router5

Usage

rxjs-router5 exports a single function createObservables:

import createRouter from 'router5';
import createObservables from 'rxjs-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.

Related