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

cycle-hashrouter-most-driver

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-hashrouter-most-driver

A simple hash-router to be used with Cycle's most-run

  • 0.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

This is a driver for all your pure-most Cycle apps (think Motorcycle) that needs a router only for the client.

It aims to be compatible with cyclic-router. The problem with this is that, besides being too bloated (with all the history package inside and plumbing), it focuses too much on server-side routing, so some glitches appears unexpectedly when you use the hash-router. Hash routers are arguably simpler, so I guess you can use this package if you don't need server-side routing.

Install

npm install --save cycle-hashrouter-most-driver

Use

import most from 'most'
import hold from '@most/hold'
import Cycle from '@cycle/most-run'
import {makeDOMDriver, h} from '@motorcycle/dom'
import hashRouterDriver from 'cycle-hashrouter-most-driver'

Cycle.run(app, {
  DOM: makeDOMDriver('#container', [
    require('snabbdom/modules/props'),
    require('snabbdom/modules/style')
  ]),
  ROUTER: hashRouterDriver
})

function app ({DOM, ROUTER}) {
  let match$ = hold(
    ROUTER.define({
      '/': {where: 'HOME'},
      '/item/:itemId': id => ({where: 'ITEM', id})
    })
  )

  let vtree$ = match$
    .map(({path, qs, value}) =>
      h('div',
        `you are on path ${path}, querystring ${qs},
        matching the path of ${value.where} and maybe the id ${value.id}.`
      )
    )

  return {
    DOM: vtree$,
    ROUTER: most.of('/item/2143').delay(2000)
  }
}

Keywords

FAQs

Package last updated on 10 Jul 2016

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