/**
 * Router
 * You could also use something like ReactRouter, but that doesn't
 * quite give Microcosm the same stress test
 */

import Route from 'actions/route'
import page from 'page'

let routes = {
  '/'         : require('../components/layouts/Home'),
  '/list/:id' : require('../components/layouts/Show')
}

export default {

  install(flux) {
    Object.keys(routes).forEach(route => {
      page(route, function({ params }) {
        flux.send(Route.set, { handler: routes[route], params })
      })
    })

    page.start()
  }

}

@@ -200,15 +200,24 @@
 s = 
-%7B
+%5B
 %0A 
+ %7B path:
  '/'
+,
     
@@ -221,16 +221,23 @@
         
+handler
 : requir
@@ -271,11 +271,21 @@
 me')
+ %7D
 ,%0A 
+ %7B path:
  '/l
@@ -292,17 +292,25 @@
 ist/:id'
- 
+, handler
 : requir
@@ -340,18 +340,20 @@
 s/Show')
-%0A%7D
+ %7D%0A%5D
 %0A%0Aexport
@@ -378,20 +378,19 @@
 all(
-flux
+app
 ) %7B%0A    
 Obje
@@ -389,161 +389,393 @@
     
-Object.keys(routes).forEach(
+let action = app.send(Route.set)%0A%0A    // Create a callback for each 
 route 
-=%3E %7B%0A      page(route, function(%7B params %7D) %7B%0A        flux.send(Route.set, %7B handler: routes%5Broute%5D, params %7D)%0A     
+that pushes the event%0A    // into the app's dispatcher%0A    //%0A    // TODO: Ideally, we'd detect that the route changed and%0A    // reduce down to a route/handler within the associated%0A    // store or action%0A    routes.forEach((%7B path, handler %7D) =%3E %7B%0A      page(path, (%7B params %7D) =%3E action(%7B handler, params
  %7D)
+)
 %0A   

Make routes a list