Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cycle-vtree-switcher

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cycle-vtree-switcher

A Cycle.js helper for switching between route handlers

  • 2.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Cycle VTree Switcher

A helper for Cycle.js apps to perform routing.

Install

npm install cycle-vtree-switcher

API

vtreeSwitcher(routes: Object, responses: Object) -> [vtree$: Observable, requests: Object]

Input:

  • routes: an object mapping from routington route definitions to route handlers which are functions like Cycle.js main functions: main(responses: Object) -> requests: Object. cycle-vtree-switcher uses cycle-route under the hood so it also supports * as the default route.
  • responses: an object containing Cycle.js driver responses/sources. Must include a Path response, which can be built using cycle-pushstate-driver.

Output:

  • vtree$: an Observable of vtrees that is the result of switching among the vtree outputs of the route handlers according to the current path
  • requests: an object containing Cycle.js driver requests/sinks, which you can combine to return to the drivers

Gotchas

  • Rx.Observable.combineLatest is used to combine the route and route handlers, and it will only emit when every source has emitted, so make sure to have each route handler emit a starting vtree. This could be a loading page.

Usage

Check out the example.

Real World Example

iouo.me

FAQs

Package last updated on 22 Oct 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc