
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
cycle-routing-driver
Advanced tools
Routing driver for CycleJS that enables simple client-side routing.
npm install --save cycle-routing-driver
Updating the location bar and clicking links already works, so most of the work is hands-off. If you do need to force a route change based on an event, just stream it in via the sinks.
import {run} from '@cycle/run'
import makeRoutingDriver, {routes} from 'lib/cyclejs/routing-driver'
function main(sources) {
// in addition to path data and parameters, we get query string data so your page can render accordingly
const modal_ = sources.route.map(({query}) => query.modal)
return {
// other stuff...,
route: xs.merge(
// if you would prefer to just bounce bad urls somewhere, you can!
sources.route.filter(({page}) => page === `404`).mapTo({page: `homepage`}),
// updating the URL always happens contextually - what streams through is reduced into the existing route
sources.DOM.select(`.signup-modal`).events(`click`).mapTo({query: {modal: `signup`}}),
// mapping query values to null removes them entirely
sources.DOM.select(`.modal-close`).events(`click`).mapTo({query: {modal: null}}),
),
}
}
run(main, {
// other stuff...,
route: makeRoutingDriver(
// the routes DSL provides a clean interface for defining basic routes
routes`
homepage
about
post (/posts/:post) -> view
view
edit
performance -> dashboard
demographics
reach
dashboard
search-ranking
`,
{
params: {
post: {
toData: _ => _,
toParam: data => data.id || data,
},
},
}
)
})
FAQs
A bare-bones router for simple frontend routing in CycleJS
The npm package cycle-routing-driver receives a total of 24 weekly downloads. As such, cycle-routing-driver popularity was classified as not popular.
We found that cycle-routing-driver demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.