Giter Site home page Giter Site logo

router5's Introduction

npm version Build Status Coverage Status

router5

Join the chat at https://gitter.im/router5/router5

Official website: router5.github.io

A simple but powerful HTML5 router, based on route-node and path-parser.

API will be subject to change, until 1.0.0 is reached. Rest assured no breaking changes will be introduced without bumping the minor version up. If you have missed something, you can look at the CHANGELOG. You can also look at the ROADMAP for planned improvements and evolutions. If you have suggestions, I'm happy to discuss them.

What is it?

It is an HTML5 router, using history and organising named routes in a tree. Browser support is limited to modern browsers implementing session history: http://caniuse.com/#search=history.

Router 5 supports use of hash in URL, but session history is still required: deciding to use a hash or not is therefore not a decision based on browser support, but rather a decision based on server capabilities!

It is aimed at applications rendering a tree of components, but can easily be used elsewhere. This router is library and framework agnostic, and makes no asumption on your implementation. It favours convention over configuration, by giving you the means to observe route changes and to react to them. Afterall, why treat route changes any different than data changes?

You can read more about motivations behind it here: Why router5?.

To get started, look here: Get started

Features

  • Use of hash (#)
  • Default start route: a default route to navigate to on load if the current URL doesn't match any route. Similar to $routeProvider.otherwise() in Angular ngRoute module.
  • Start and stop
  • Nested named routes: routes are identified by names and parameters so you don't have to manipulate URLs directly. Routes can be nested, introducing the notion of route segments.
  • Route change listeners: listen to any route change, or register listeners for a specific route.
  • Route node change listeners: you can add listeners to be triggered on a specific named route node. They will be triggered if that named route node is the node a component tree needs to be re-rendered from.
  • Segments activation: you can control whether or not a route can be accessed by specifying a canActivate function per node. Supports asynchronous results.
  • Segments deactivation: you can register segment components. On a route change, it will ask those components through their canDeactivate method if they allow navigation. Similar to Angular 2 and Aurelia routers. Supports asynchronous results.
  • Transition "middleware" function: handle any data updates or other asynchronous actions before updating your view.
  • Universal applications: use on client and server side
  • You are in control! You decide what to do on a route change and how to do it.

Guides

API

Examples

Integration

Related

router5's People

Contributors

troch avatar gitter-badger avatar

Watchers

Alvar Laigna avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.