![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
cherrytree
Advanced tools
Cherrytree is a flexible hierarchical client side router. Cherrytree translates every URL change to a transition object and a list of matching routes. You then apply a middleware function to translate the transition data into the desired state of your application.
You can get cherrytree from npm - it supports both AMD and CJS.
$ npm install --save cherrytree
In a CJS environment, simply require it as usual, the dependencies will be loaded from npm
require('cherrytree')
In an AMD environment, require the standalone UMD build - this version has all of the dependencies bundled
require('cherrytree/standalone')
The size excluding all deps is ~10.23 kB gzipped and the standalone build with all deps is ~15.27 kB gzipped.
var cherrytree = require('cherrytree')
// create the router
var router = cherrytree()
// provide your route map
router.map(function (route) {
route('application', {path: '/'}, function () {
route('messages')
route('status', {path: ':user/status/:id'})
route('profile', {path: ':user'}, function () {
route('profile.index')
route('profile.lists')
route('profile.edit')
})
})
})
// install any number of middleware
// middleware can be asynchronous
router.use(function (transition) {
// e.g. use require.js to partially
// load your app
return Promise.all(transition.routes.map(function (route) {
return new Promise(function (resolve) {
require(['./views/' + route.name], function (ViewClass) {
route.ViewClass = ViewClass
resolve()
})
})
}))
})
// middleware can also be synchronous
router.use(function (transition) {
transition.routes.forEach(function (route, i) {
route.view = new route.ViewClass({
// access dynamic params and query params
params: transition.params,
query: transition.query
})
var parent = transition.routes[i-1]
var $outlet = parent ? parent.view.$el.find('.outlet') : $(document.body)
$outlet.html(view.render().el)
})
})
// transition itself is a promise
// use .then to know when transition has completed
// use .catch to know when transition has failed
router.use(function (transition) {
transition.catch(function (err) {
// transition can fail if it is cancelled or redirected
// ignore those errors if you want to only listen to real errors
// such as when one of the middleware fails, e.g. to fetch data
if (err.type !== 'TransitionCancelled' && err.type !== 'TransitionRedirected') {
dispatchError(err.message)
}
})
})
// start listening to browser's location bar changes
router.listen()
Read the API docs or the brief guide.
You can clone this repo if you want to run the examples
locally. Currently the examples are
router.generate('commit', {sha: '1e2760'})
router.transitionTo('commits')
cherrytree
you'll have to write all of the glue code for integrating into React yourself. However, what you get instead is a smaller, simpler and hopefully more flexible library which should be more adaptable to your specific needs. This also means that you can use a react-router
like a approach with other React
inspired libraries such as mercury
, riot
or om
.FAQs
Cherrytree - a flexible hierarchical client side router
The npm package cherrytree receives a total of 4 weekly downloads. As such, cherrytree popularity was classified as not popular.
We found that cherrytree 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
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.