xstream-router5
TypeScript icon, indicating that this package has built-in type declarations

8.0.1 • Public • Published

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

Related

/xstream-router5/

    Package Sidebar

    Install

    npm i xstream-router5

    Weekly Downloads

    0

    Version

    8.0.1

    License

    MIT

    Unpacked Size

    128 kB

    Total Files

    6

    Last publish

    Collaborators

    • troch