Routes

March 17, 2015 ยท View on GitHub

Routes are url partials which are associated to Sections.

What that basically means is that you will define strings/url's which will execute Sections.

For example you could define your routes like this:

module.exports = {
    '/': require('../SectionLanding'),
    '/about': require('../SectionAbout')
};

Routing is handled by the module bw-router which primarily uses the module routes.

bw-router primarily watches the window.location.hash for changes. Once a change occurs it will try to figure out which Sections should be opened.

For instance our Browsers url might look something like:

http://localhost:8080/#!/about

In this case the route '/about': require('../SectionAbout') would be used and SectionAbout would initialized and then animated in.

Something to note is that bw-router can work outside of the browser. For instance bigwheel can be used as a framework to create command line applications, or be used in browser like environments like CocoonJS. There is no relliance on window.location. In this case simply bigwheel's go method would be used to cause the router to change sections. (more on this later)